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

Series[sparse].to_sparse messes up length #22389

TomAugspurger opened this issue Aug 16, 2018 · 0 comments


None yet
1 participant
Copy link

commented Aug 16, 2018

In [23]: a = pd.Series(pd.SparseArray([1, 2, None, 2]))

In [24]: b = a.to_sparse()

In [25]: len(a), len(b)
Out[25]: (4, 3)

In [26]: b
0    1.0
1    2.0
2    2.0
dtype: float64
Indices: array([0, 1, 2], dtype=int32)

Fixing in #22325, this is to link from the release notes.

@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Aug 16, 2018

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Aug 18, 2018

brute4s99 added a commit to brute4s99/pandas that referenced this issue Nov 19, 2018

[API/REF]: SparseArray is an ExtensionArray (pandas-dev#22325)
Makes SparseArray an ExtensionArray.

* Fixed DataFrame.__setitem__ for updating to sparse.

Closes pandas-dev#22367

* Fixed Series[sparse].to_sparse

Closes pandas-dev#22389

Closes pandas-dev#21978
Closes pandas-dev#19506
Closes pandas-dev#22835
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.