Skip to content

FrozenSeries

freezeframe.series.FrozenSeries

FrozenSeries(array)

Typed, immutable series backed by a pyarrow.Array.

The type parameter T reflects the Python type of each element and is used by static analysis tools. At runtime the Arrow type is available via the type property.

Parameters:

Name Type Description Default
array Array

The underlying pa.Array. Must not be mutated externally after construction.

required
Source code in src\freezeframe\series.py
def __init__(self, array: pa.Array) -> None:
    object.__setattr__(self, "_array", array)

null_count property

null_count

Number of null values.

type property

type

The Arrow DataType of this series.

__eq__

__eq__(other)

Element-wise equality — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __eq__(self, other: Any) -> pa.Array:
    """Element-wise equality — returns a boolean ``pa.Array``."""
    return pc.equal(self._array, self._rhs(other))  # type: ignore[attr-defined]

__ge__

__ge__(other)

Element-wise greater-than-or-equal — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __ge__(self, other: Any) -> pa.Array:
    """Element-wise greater-than-or-equal — returns a boolean ``pa.Array``."""
    return pc.greater_equal(self._array, self._rhs(other))  # type: ignore[attr-defined]

__getitem__

__getitem__(index: int) -> T
__getitem__(index: slice) -> FrozenSeries[T]
__getitem__(index)

Return a single element or a sliced sub-series.

Parameters:

Name Type Description Default
index int | slice

An integer index returns the element as a Python value (nullable columns may return None). A slice returns a new FrozenSeries over the selected range.

required
Source code in src\freezeframe\series.py
def __getitem__(self, index: int | slice) -> T | FrozenSeries[T]:
    """Return a single element or a sliced sub-series.

    Parameters
    ----------
    index:
        An integer index returns the element as a Python value (nullable
        columns may return ``None``).  A slice returns a new
        ``FrozenSeries`` over the selected range.
    """
    if isinstance(index, slice):
        return FrozenSeries(self._array[index])
    return self._array[index].as_py()

__gt__

__gt__(other)

Element-wise greater-than — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __gt__(self, other: Any) -> pa.Array:
    """Element-wise greater-than — returns a boolean ``pa.Array``."""
    return pc.greater(self._array, self._rhs(other))  # type: ignore[attr-defined]

__iter__

__iter__()

Iterate over elements as Python values (nulls become None).

Source code in src\freezeframe\series.py
def __iter__(self) -> Iterator[T]:
    """Iterate over elements as Python values (nulls become ``None``)."""
    for scalar in self._array:
        yield scalar.as_py()

__le__

__le__(other)

Element-wise less-than-or-equal — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __le__(self, other: Any) -> pa.Array:
    """Element-wise less-than-or-equal — returns a boolean ``pa.Array``."""
    return pc.less_equal(self._array, self._rhs(other))  # type: ignore[attr-defined]

__len__

__len__()

Number of elements.

Source code in src\freezeframe\series.py
def __len__(self) -> int:
    """Number of elements."""
    return len(self._array)

__lt__

__lt__(other)

Element-wise less-than — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __lt__(self, other: Any) -> pa.Array:
    """Element-wise less-than — returns a boolean ``pa.Array``."""
    return pc.less(self._array, self._rhs(other))  # type: ignore[attr-defined]

__ne__

__ne__(other)

Element-wise inequality — returns a boolean pa.Array.

Source code in src\freezeframe\series.py
def __ne__(self, other: Any) -> pa.Array:
    """Element-wise inequality — returns a boolean ``pa.Array``."""
    return pc.not_equal(self._array, self._rhs(other))  # type: ignore[attr-defined]

equals

equals(other)

Return True if both series have identical type and values.

Unlike ==, this returns a single bool and correctly handles null values (two nulls at the same position are considered equal).

Parameters:

Name Type Description Default
other FrozenSeries[Any]

The series to compare against.

required
Source code in src\freezeframe\series.py
def equals(self, other: FrozenSeries[Any]) -> bool:
    """Return ``True`` if both series have identical type and values.

    Unlike ``==``, this returns a single ``bool`` and correctly handles
    null values (two nulls at the same position are considered equal).

    Parameters
    ----------
    other:
        The series to compare against.
    """
    if not isinstance(other, FrozenSeries):
        return NotImplemented
    return self._array.equals(other._array)

to_arrow

to_arrow()

Return the underlying pa.Array directly.

Source code in src\freezeframe\series.py
def to_arrow(self) -> pa.Array:
    """Return the underlying ``pa.Array`` directly."""
    return self._array

to_pylist

to_pylist()

Return elements as a plain Python list (nulls become None).

Source code in src\freezeframe\series.py
def to_pylist(self) -> list[T | None]:
    """Return elements as a plain Python list (nulls become ``None``)."""
    return self._array.to_pylist()