pyarrow.field¶
- pyarrow.field(name, type, bool nullable=True, metadata=None)¶
Create a pyarrow.Field instance.
- Parameters:
- Returns:
- field
pyarrow.Field
- field
Examples
Create an instance of pyarrow.Field:
>>> import pyarrow as pa >>> pa.field('key', pa.int32()) pyarrow.Field<key: int32> >>> pa.field('key', pa.int32(), nullable=False) pyarrow.Field<key: int32 not null>
>>> field = pa.field('key', pa.int32(), ... metadata={"key": "Something important"}) >>> field pyarrow.Field<key: int32> >>> field.metadata {b'key': b'Something important'}
Use the field to create a struct type:
>>> pa.struct([field]) StructType(struct<key: int32>)