Access list operations for this expression. Returns: A _ListNamespace that provides list-specific operations for both PyArrow ``List`` and ``FixedSizeList`` columns. Example: >>> from ray.data.expressions import col >>> import ray
(self)
| 804 | |
| 805 | @property |
| 806 | def list(self) -> "_ListNamespace": |
| 807 | """Access list operations for this expression. |
| 808 | |
| 809 | Returns: |
| 810 | A _ListNamespace that provides list-specific operations for both |
| 811 | PyArrow ``List`` and ``FixedSizeList`` columns. |
| 812 | |
| 813 | Example: |
| 814 | >>> from ray.data.expressions import col |
| 815 | >>> import ray |
| 816 | >>> ds = ray.data.from_items([ |
| 817 | ... {"items": [1, 2, 3]}, |
| 818 | ... {"items": [4, 5]} |
| 819 | ... ]) |
| 820 | >>> ds = ds.with_column("num_items", col("items").list.len()) |
| 821 | >>> ds = ds.with_column("first_item", col("items").list[0]) |
| 822 | >>> ds = ds.with_column("slice", col("items").list[1:3]) |
| 823 | """ |
| 824 | from ray.data.namespace_expressions.list_namespace import _ListNamespace |
| 825 | |
| 826 | return _ListNamespace(self) |
| 827 | |
| 828 | @property |
| 829 | def str(self) -> "_StringNamespace": |