polars.internals.expr.ExprStructNameSpace.field¶
- ExprStructNameSpace.field(name: str) polars.internals.expr.Expr ¶
Retrieve one of the fields of this Struct as a new Series
- Parameters
- name
Name of the field
Examples
>>> df = ( ... pl.DataFrame( ... { ... "int": [1, 2], ... "str": ["a", "b"], ... "bool": [True, None], ... "list": [[1, 2], [3]], ... } ... ) ... .to_struct("my_struct") ... .to_frame() ... ) >>> df.select(pl.col("my_struct").struct.field("str")) shape: (2, 1) ┌─────┐ │ str │ │ --- │ │ str │ ╞═════╡ │ a │ ├╌╌╌╌╌┤ │ b │ └─────┘