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])
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Series.sparse.html