polars.Expr.name.prefix_fields#

Expr.name.prefix_fields(prefix: str) Expr[source]#

Add a prefix to all fields name of a struct.

Parameters:
prefix

Prefix to add to the filed name

Notes

This only take effects for struct.

Examples

>>> df = pl.DataFrame({"x": {"a": 1, "b": 2}})
>>> df.select(pl.col("x").name.prefix_fields("prefix_")).schema
OrderedDict({'x': Struct({'prefix_a': Int64, 'prefix_b': Int64})})