polars.DataTypeExpr.struct.field_dtype#

DataTypeExpr.struct.field_dtype(
field_name: str,
) DataTypeExpr[source]#

Get the DataType of field with a specific field name.

Notes

The struct namespace has implemented __getitem__ so you can also access fields by index:

>>> (
...     pl.Struct({"x": pl.Int64, "y": pl.String})
...     .to_dtype_expr()
...     .struct[1]
...     .collect_dtype({})
... )
String