Skip to content

BUG: Sparse master issue #10627

Closed
Closed
@kawochen

Description

@kawochen

These other issues will be fixed by this

The fundamental issue is that slicing is broken in sparse.

In [11]: s = Series([1]+[np.nan]*5).to_sparse()

In [12]: s
Out[12]: 
0     1
1   NaN
2   NaN
3   NaN
4   NaN
5   NaN
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([1], dtype=int32)

In [13]: s.iloc[0:3]
Out[13]: 
[1.0, nan, nan]
Fill: nan
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([1], dtype=int32)

In [14]: type(s.iloc[0:3])
Out[14]: pandas.sparse.array.SparseArray

In [15]: type(s)
Out[15]: pandas.sparse.series.SparseSeries
[14] should be a SparseSeries (not SparseArray which is the underlying object the SparseSeries holds). its not getting wrapped when sliced somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesSparseSparse Data Type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions