| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.field.html | [Back] [Original] |
Section Navigation
Create a pyarrow.Field instance.
str or bytesName of the field.
Alternatively, you can also pass an object that implements the Arrow
PyCapsule Protocol for schemas (has an __arrow_c_schema__ method).
pyarrow.DataType or strArrow datatype of the field or a string matching one.
TrueWhether the fields values are nullable.
dict, default NoneOptional field metadata, the keys and values must be coercible to bytes.
pyarrow.FieldExamples
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>)
A str can also be passed for the type parameter:
>>> pa.field('key', 'int32')
pyarrow.Field<key: int32>
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |