Source code for xpark.dataset.namespace_expressions.list_namespace
"""List namespace for expression operations on list-typed columns."""
from __future__ import annotations
from dataclasses import dataclass
from ray.data.namespace_expressions.list_namespace import _ListNamespace as RayListNamespace
[docs]
@dataclass
class _ListNamespace(RayListNamespace):
"""Namespace for list operations on expression columns.
This namespace provides methods for operating on list-typed columns using
PyArrow compute functions.
Example:
>>> from xpark.dataset.expressions import col
>>> # Get length of list column
>>> expr = col("items").list.len()
>>> # Get first item using method
>>> expr = col("items").list.get(0)
>>> # Get first item using indexing
>>> expr = col("items").list[0]
>>> # Slice list
>>> expr = col("items").list[1:3]
"""