pandas.Series.to_sparse

Series.to_sparse(self, kind='block', fill_value=None)[source]

Convert Series to SparseSeries.

Parameters
kind{‘block’, ‘integer’}, default ‘block’
fill_valuefloat, defaults to NaN (missing)

Value to use for filling NaN values.

Returns
SparseSeries

Sparse representation of the Series.

Scroll To Top