pyarrow.Field¶
- class pyarrow.Field¶
Bases:
_Weakrefable
A named field, with a data type, nullability, and optional metadata.
Notes
Do not use this class’s constructor directly; use pyarrow.field
- __init__(*args, **kwargs)¶
Methods
__init__
(*args, **kwargs)add_metadata
(self, metadata)equals
(self, Field other, ...)Test if this field is equal to the other
flatten
(self)Flatten this field.
remove_metadata
(self)Create new field without metadata, if any
with_metadata
(self, metadata)Add metadata as dict of string keys and values to Field
with_name
(self, name)A copy of this field with the replaced name
with_nullable
(self, nullable)A copy of this field with the replaced nullability
with_type
(self, DataType new_type)A copy of this field with the replaced type
Attributes
- add_metadata(self, metadata)¶
- equals(self, Field other, bool check_metadata=False)¶
Test if this field is equal to the other
- Parameters:
- other
pyarrow.Field
- check_metadatabool, default
False
Whether Field metadata equality should be checked as well.
- other
- Returns:
- is_equalbool
- flatten(self)¶
Flatten this field. If a struct field, individual child fields will be returned with their names prefixed by the parent’s name.
- Returns:
- fields
List
[pyarrow.Field
]
- fields
- metadata¶
- name¶
- nullable¶
- remove_metadata(self)¶
Create new field without metadata, if any
- Returns:
- field
pyarrow.Field
- field
- type¶
- with_metadata(self, metadata)¶
Add metadata as dict of string keys and values to Field
- Parameters:
- metadata
dict
Keys and values must be string-like / coercible to bytes
- metadata
- Returns:
- field
pyarrow.Field
- field
- with_name(self, name)¶
A copy of this field with the replaced name
- Parameters:
- name
str
- name
- Returns:
- field
pyarrow.Field
- field
- with_nullable(self, nullable)¶
A copy of this field with the replaced nullability
- Parameters:
- nullablebool
- Returns:
- field:
pyarrow.Field
- field:
- with_type(self, DataType new_type)¶
A copy of this field with the replaced type
- Parameters:
- new_type
pyarrow.DataType
- new_type
- Returns:
- field
pyarrow.Field
- field