pandas.SparseDtype #
- 熊猫类 。SparseDtype ( dtype=<class 'numpy.float64'> , fill_value=None ) [来源] #
存储在
SparseArray
.该数据类型实现了 pandas ExtensionDtype 接口。
- 参数:
- dtype str、ExtensionDtype、numpy.dtype、类型、默认 numpy.float64
存储非填充值的基础数组的数据类型。
- fill_value标量,可选
标量值未存储在 SparseArray 中。默认情况下,这取决于dtype。
数据类型
na_值
漂浮
np.nan
整数
0
布尔值
False
日期时间64
pd.NaT
时间增量64
pd.NaT
可以通过指定fill_value来覆盖默认值。
例子
>>> 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
属性
没有任何
方法
没有任何