Skip to content

field()

freezeframe.column.field

field(*, arrow_type=None, description='')

Optional per-column metadata for FrozenFrame field definitions.

field() is only needed when you want to override the default Python→Arrow type mapping or attach documentation to a column. For the common case, a bare type annotation is sufficient.

Parameters:

Name Type Description Default
arrow_type DataType | None

Override the Arrow DataType for this column. If omitted, the type is resolved from the annotation via the default mapping.

None
description str

Human-readable documentation for this column. Has no runtime effect.

''

Examples:

>>> import pyarrow as pa
>>> from freezeframe import FrozenFrame, field
>>>
>>> class Events(FrozenFrame):
...     user_id: int
...     score:   float = field(arrow_type=pa.float32())
...     label:   str   = field(description="event classification label")
Source code in src\freezeframe\column.py
def __init__(
    self,
    *,
    arrow_type: pa.DataType | None = None,
    description: str = "",
) -> None:
    self.arrow_type = arrow_type
    self.description = description