-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
BugReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeSparseSparse Data TypeSparse Data Type
Milestone
Description
Code Sample, a copy-pastable example if possible
Two (somewhat related) issues:
>>> pd.Series({1: 1})
1 1
dtype: int64
>>> pd.SparseSeries({1: 1})
---------------------------------------------------------------------------
AttributeError: 'dict' object has no attribute 'index'
>>> pd.Series({1: 1}, index=[0, 1, 2])
0 NaN
1 1.0
2 NaN
dtype: float64
>>> pd.SparseSeries({1: 1.}, index=[0, 1, 2])
0 1.0
1
2
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([1], dtype=int32)
Problem description
SparseSeries initialization from dict acts too differently from Series'.
Expected Output
>>> pd.SparseSeries({1: 1})
1 1.0
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([1], dtype=int32)
>>> pd.SparseSeries({1: 1.}, index=[0, 1, 2])
0 NaN
1 1.0
2 NaN
dtype: float64
BlockIndex
Block locations: array([1], dtype=int32)
Block lengths: array([1], dtype=int32)
Output of pd.show_versions()
pandas 0.21.0.dev+223.ga9421af1a
Metadata
Metadata
Assignees
Labels
BugReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeSparseSparse Data TypeSparse Data Type