pyarrow.DataType

pyarrow.DataType#

DataType 是所有 pyarrow.Arrow 数据类型的基类。每种数据类型都是这个类的实例。

bit_width#

定点宽度类型(fixed width type)的位宽。

import pyarrow as pa
pa.int64().bit_width
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pyarrow as pa
      2 pa.int64().bit_width

ModuleNotFoundError: No module named 'pyarrow'

num_buffers#

构造数组类型所需的数据缓冲区数量,不包括子项。

import pyarrow as pa

pa.int64().num_buffers, pa.string().num_buffers
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 1
----> 1 import pyarrow as pa
      3 pa.int64().num_buffers, pa.string().num_buffers

ModuleNotFoundError: No module named 'pyarrow'

num_fields#

子字段的数量。

import pyarrow as pa
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[3], line 1
----> 1 import pyarrow as pa

ModuleNotFoundError: No module named 'pyarrow'
pa.int64(), pa.int64().num_fields
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 pa.int64(), pa.int64().num_fields

NameError: name 'pa' is not defined
pa.list_(pa.string()), pa.list_(pa.string()).num_fields
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 pa.list_(pa.string()), pa.list_(pa.string()).num_fields

NameError: name 'pa' is not defined
struct = pa.struct({'x': pa.int32(), 'y': pa.string()})
struct, struct.num_fields
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 struct = pa.struct({'x': pa.int32(), 'y': pa.string()})
      2 struct, struct.num_fields

NameError: name 'pa' is not defined