A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/pandas-docs/stable/reference/api/../api/pandas.SparseDtype.html below:

pandas.SparseDtype — pandas 2.3.1 documentation

pandas.SparseDtype#
class pandas.SparseDtype(dtype=<class 'numpy.float64'>, fill_value=None)[source]#

Dtype for data stored in SparseArray.

This dtype implements the pandas ExtensionDtype interface.

Parameters:
dtypestr, ExtensionDtype, numpy.dtype, type, default numpy.float64

The dtype of the underlying array storing the non-fill value values.

fill_valuescalar, optional

The scalar value not stored in the SparseArray. By default, this depends on dtype.

dtype

na_value

float

np.nan

int

0

bool

False

datetime64

pd.NaT

timedelta64

pd.NaT

The default value may be overridden by specifying a fill_value.

Attributes

Methods

Examples

>>> ser = pd.Series([1, 0, 0], dtype=pd.SparseDtype(dtype=int, fill_value=0))
>>> ser
0    1
1    0
2    0
dtype: Sparse[int64, 0]
>>> ser.sparse.density
0.3333333333333333

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4