pandas.ArrowDtype#

class pandas.ArrowDtype(pyarrow_dtype)[源代码]#

Arrow 的数据类型的扩展类型。

警告

ArrowDtype 被认为是实验性的。实现和部分 API 可能会在不发出警告的情况下更改。

虽然大多数 dtype 参数都可以接受 “字符串” 构造函数,例如 "int64[pyarrow]",但如果数据类型包含类似 pyarrow.timestamp 的参数,ArrowDtype 会很有用。

Parameters:
pyarrow_dtypepa.DataType

pyarrow.DataType 的一个实例。

Returns:
ArrowDtype

Examples

>>> import pyarrow as pa
>>> pd.ArrowDtype(pa.int64())
int64[pyarrow]

带有参数的类型必须使用 ArrowDtype 进行构造。

>>> pd.ArrowDtype(pa.timestamp("s", tz="America/New_York"))
timestamp[s, tz=America/New_York][pyarrow]
>>> pd.ArrowDtype(pa.list_(pa.int64()))
list<item: int64>[pyarrow]

Attributes

pyarrow_dtype

Methods

None