Polars 2 · Expressions, grouping and joins
Work with dates
Parse text to dates and extract parts with the dt namespace.
dates = pl.DataFrame({"d": ["2026-01-15", "2026-03-02"]}).with_columns(pl.col("d").str.to_date())
dates.with_columns(pl.col("d").dt.month().alias("month"))
Official Polars 2 documentation
More expressions, grouping and joins commands
- Group and aggregate
- Conditional columns
- Join two DataFrames
- Handle missing values
- Work with strings
- Window functions
All expressions, grouping and joins commands · Polars 2 cheatsheet