我找到了 NumPy 的标量类型列表:https://docs.scipy.org/doc/numpy-1.12.0/user/basics.types.html
我知道 Pandas 为这些添加了时间戳类型。还有更多类型吗?某处是否有 Pandas 标量类型的完整列表?
最佳答案
一般来说(并且松散地)说,pandas 列只是标记为 numpy 数组并且具有可比较的 dtype。我所知道的唯一异常(exception)是 Pandas 分类类型。
这是一个 example dtype listing from the official docs .不能保证是详尽无遗的,但据我所知,它非常接近。
In [423]: df.dtypes
Out[423]:
bool1 bool
bool2 bool
category category
dates datetime64[ns]
float64 float64
int64 int64
string object
uint8 uint8
tdeltas timedelta64[ns]
uint64 uint64
other_dates datetime64[ns]
tz_aware_dates datetime64[ns, US/Eastern]
dtype: object
请注意,对象 dtype 包括字符串,并且基本上是除 int、float、bool、category 或 datetime/timedelta 之外的任何内容。对象 dtype 实际上只是任何通用 python 类型的持有者,可以是列表、字典等。
关于pandas - 什么是可能的 Pandas 基本/标量数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44963503/