pandas.Series.sparse#

Series.sparse()[source]#

Accessor for SparseSparse from other sparse matrix data types.

Examples

>>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
>>> ser.sparse.density
0.6
>>> ser.sparse.sp_values
array([2, 2, 2])