Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.SparseDtype#

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

Dtype for data stored inSparseArray.

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, thisdepends ondtype.

dtype

na_value

float

np.nan

int

0

bool

False

datetime64

pd.NaT

timedelta64

pd.NaT

The default value may be overridden by specifying afill_value.

Attributes

None

Methods

None

Examples

>>>ser=pd.Series([1,0,0],dtype=pd.SparseDtype(dtype=int,fill_value=0))>>>ser0    11    02    0dtype: Sparse[int64, 0]>>>ser.sparse.density0.3333333333333333

[8]ページ先頭

©2009-2025 Movatter.jp