API/BUG: SparseSeries.shape ignores fill_value · Issue #10452 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@sinhrks

Description

@sinhrks

SparseSeries.shape seems to return incorrect result ignoring shapes filled by fill_value.

s = pd.SparseSeries([0, 0, 1, 0], fill_value=0)
s
#0    0
#1    0
#2    1
#3    0
# dtype: int64
# BlockIndex
# Block locations: array([2], dtype=int32)
# Block lengths: array([1], dtype=int32)

len(s)
#4

# must be (4, )?
s.shape
# (1,)

# OK
s._data.shape
# (4,)