pandas.Series.to_sparse

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

Convert Series to SparseSeries.

Deprecated since version 0.25.0.

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

Value to use for filling NaN values.

Returns:
SparseSeries

Sparse representation of the Series.

Scroll To Top