Skip to content

SparseDataFrame(scipy.sparse.matrix) constructor generates lots of warnings #26777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorisvandenbossche opened this issue Jun 11, 2019 · 0 comments · Fixed by #28425
Closed
Labels
Deprecate Functionality to remove in pandas Sparse Sparse Data Type

Comments

@jorisvandenbossche
Copy link
Member

cc @TomAugspurger another one ...

Passing a sparse matrix to the SparseDataFrame constructor can generate a flood of warning message (I think because each column of the sparse matrix is converted to a SparseSeries, triggering the warning each time):

In [2]: import scipy.sparse                    

In [3]: sparse = scipy.sparse.rand(10, 10, 0.5) 

In [4]: pd.SparseDataFrame(sparse)                  
/home/joris/miniconda3/envs/dev37/bin/ipython:1: FutureWarning: SparseDataFrame is deprecated and will be removed in a future version.
Use a regular DataFrame whose columns are SparseArrays instead.

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  #!/home/joris/miniconda3/envs/dev37/bin/python
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
/home/joris/scipy/pandas/pandas/core/sparse/frame.py:230: FutureWarning: SparseSeries is deprecated and will be removed in a future version.
Use a Series with sparse values instead.

    >>> series = pd.Series(pd.SparseArray(...))

See http://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#migrating for more.

  sparse_index=BlockIndex(N, blocs, blens))
Out[4]: 
          0         1         2         3         4         5         6         7         8         9
0  0.856466  0.482052  0.289636       NaN  0.369485       NaN  0.907167       NaN       NaN  0.531253
1       NaN       NaN  0.305235       NaN       NaN       NaN  0.744132  0.001257       NaN  0.406300
2       NaN       NaN  0.638244       NaN       NaN       NaN  0.436574       NaN       NaN  0.225573
3  0.881299       NaN  0.645047  0.203569       NaN  0.341134       NaN  0.553526  0.539011  0.682595
4  0.481258       NaN       NaN  0.919469       NaN  0.101564       NaN       NaN       NaN       NaN
5  0.244346  0.282246       NaN       NaN       NaN       NaN       NaN       NaN  0.412830       NaN
6  0.051837       NaN  0.101553  0.512826  0.985031  0.679645  0.248445       NaN  0.081652       NaN
7  0.048519       NaN  0.621497  0.483698       NaN       NaN       NaN  0.548918       NaN  0.716907
8       NaN  0.801704       NaN       NaN       NaN  0.611459  0.669670       NaN  0.835271  0.336365
9  0.302106       NaN  0.672587  0.609117  0.570041  0.662911  0.684364       NaN       NaN  0.795059
@jorisvandenbossche jorisvandenbossche added Sparse Sparse Data Type Deprecate Functionality to remove in pandas labels Jun 11, 2019
@jorisvandenbossche jorisvandenbossche added this to the 0.25.0 milestone Jun 11, 2019
TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Jun 13, 2019
@jreback jreback modified the milestones: 0.25.0, Contributions Welcome Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants