Pandas 大写/小写在数据类型中有什么含义吗?

Has*_*tax 4 python numpy pandas dtype

Float32float32

Pandas 中大写和小写 dtypes 的目的是什么?

大写似乎更容易出错:TypeError: object cannot be converted to a FloatingDtype.

dtype = {
    'doom_float64': 'Float64'
    , 'radiance_float32': 'Float32'
    , 'temperature_float': 'float'
    , 'moonday_int64': 'Int64'
    , 'month_int32': 'Int32'
    , 'color_uint8': 'UInt8'
    , 'shape_int': 'int'
    , 'weekday_object': 'object'
    , 'hour_object': 'string'
    , 'kingdom_category': 'category'
}
Run Code Online (Sandbox Code Playgroud)
>>> df.dtypes

doom_float64          Float64
radiance_float32      Float32
temperature_float     float64
weekday_object         object
hour_object            string
moonday_int64           Int64
month_int32             Int32
color_uint8             UInt8
shape_int               int64
kingdom_category     category
dtype: object
Run Code Online (Sandbox Code Playgroud)

Pandas v1.2.0

Gul*_*zar 8

是的,请参见此处的示例。

\n
\n

pandas 可以使用 arrays.IntegerArray 表示可能存在缺失值的整数数据。这是在pandas 中实现的扩展类型。

\n

或者字符串别名“Int64”(注意大写“I”,以区别\nNumPy\xe2\x80\x99s \'int64\' dtype:

\n
\n

大写的类型是 pandas 类型,而不大写的类型是 numpy 类型。

\n

pandas 类型的一个特性是能够支持 nan,这不是非浮点数的 IEEE 标准。

\n