pandas.Series.sparse.fill_value#

Series.sparse.fill_value[source]#

Elements in data that are fill_value are not stored.

For memory savings, this should be the most common value in the array.

See also

SparseDtype

Dtype for data stored in SparseArray.

Series.value_counts

Return a Series containing counts of unique values.

Series.fillna

Fill NA/NaN in a Series with a specified value.

Examples

>>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
>>> ser.sparse.fill_value
0
>>> spa_dtype = pd.SparseDtype(dtype=np.int32, fill_value=2)
>>> ser = pd.Series([0, 0, 2, 2, 2], dtype=spa_dtype)
>>> ser.sparse.fill_value
2