Polars 2 · Basics
Add or change columns
Create new columns from expressions. Existing columns with the same name are replaced.
df.with_columns(
(pl.col("age") + 1).alias("next_age"),
pl.col("name").str.to_uppercase().alias("shout"),
)
Official Polars 2 documentation