Skip to content
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

concat Series[sparse] converts sp_values to NaN #24371

Closed
TomAugspurger opened this issue Dec 20, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@TomAugspurger
Copy link
Contributor

commented Dec 20, 2018

In [1]: import pandas as pd

In [2]: s = pd.Series(pd.SparseArray([0, 1], fill_value=0))

In [3]: pd.concat([s, s], axis=1, keys=['a', 'b'])
Out[3]:
     a    b
0  NaN  NaN
1  1.0  1.0
@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Dec 20, 2018

Note, the only happens when we choose to return a SparseDataFrame instead of a DataFrame of sparse values. I thought we changed that to return a DataFrame..

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Dec 20, 2018

This is the behavior on 0.23.4

In [1]: import pandas as pd

In [2]: s = pd.Series(pd.SparseArray([0, 1], fill_value=0))

In [3]: pd.concat([s, s], axis=1, keys=['a', 'b'])
Out[3]:
   a  b
0  1  1
1  1  1
@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Dec 20, 2018

Huh, those are dense values too:

In [13]: pd.concat([s, s], axis=1, keys=['a', 'b']).a.values
Out[13]: array([1, 1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.