Closed
Description
These other issues will be fixed by this
- Support dtypes other than float in sparse data structures #667 other dtypes PR ENH: Sparse int64 and bool dtype support enhancement #13849
- non-NDFFrame object error using pandas.SparseSeries.from_coo() function #10818
from_coo
issues (same as TypeError in SparseSeries.__repr__ when series longer than max_rows #10560) - BUG: sparse empty construction buggy #10079 empty construction
- TypeError in SparseSeries.__repr__ when series longer than max_rows #10560
__repr__
broken, PR BUG: Sparse misc fixes including __repr__ #12779 - Concat does not work for sparse series #10536 concat
SparseSeries
, PR BUG: SparseSeries concat results in dense #12844 - concat() on Sparse dataframe returns strange results #12174 concat
SparseDataFrame
? PR BUG: Sparse concat may fill fill_value with NaN #12966 - TST: more testing of indexing with sparse #4400 more testing of indexing (TST: Add more Sparse indexing tests #12848)
- API, DOC: SparseArray Interface and Documentation is Confusing #12794 more/better sparse docs PR b13ddd5
- API: Sparse Return Types #12855 return types
- BUG: SparseSeries/DataFrame non-float dtypes repr #13110 non float repr PR ENH: Sparse int64 and bool dtype support enhancement #13849
- _combine_const() in pandas.sparse.frame does not have uniform method signature with pandas.core.frame #13001 signatures PR ENH: Sparse int64 and bool dtype support enhancement #13849
- SparseSeries throws a ValueError exception when printing large arrays #13144 repr of large arrays (BUG: Misc fixes for SparseSeries indexing with MI #13163)
-
SparseSeries
withMultiIndex
indexing (BUG: Misc fixes for SparseSeries indexing with MI #13163) -
SparseDataFrame/Series
withMultiIndex
indexing (Wrong result of pandas.sparse.series.SparseSeries.loc with indexer of length 1 #15447) -
SparseSeries
with non-unique index indexing -
SparseDataFrame
with non-unique index indexing - slicing / reindexing
SparseDataFrame
to return subclass (BUG: Slicing subclasses of SparseDataFrames. #13787) - concat (Concatting dense and sparse dataframes breaks many common operations #16874)
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.