Skip to content

Series[sparse].to_sparse messes up length #22389

Closed
@TomAugspurger

Description

@TomAugspurger
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
Out[26]:
0    1.0
1    2.0
2    2.0
3
dtype: float64
IntIndex
Indices: array([0, 1, 2], dtype=int32)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    SparseSparse Data Type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions