pandas.Series.sparse.sp_values#
- Series.sparse.sp_values[source]#
An ndarray containing the non-
fill_valuevalues.This property returns the actual data values stored in the sparse representation, excluding the values that are equal to the
fill_value. The result is an ndarray of the underlying values, preserving the sparse structure by omitting the defaultfill_valueentries.See also
Series.sparse.to_denseConvert a Series from sparse values to dense.
Series.sparse.fill_valueElements in data that are fill_value are not stored.
Series.sparse.densityThe percent of non-
fill_valuepoints, as decimal.
Examples
>>> from pandas.arrays import SparseArray >>> s = SparseArray([0, 0, 1, 0, 2], fill_value=0) >>> s.sp_values array([1, 2])