typestar

Polars

32 steps in 10 sets of Python.

Polars is the dataframe library that took the lessons from pandas and started again in Rust. The expression API is the thing to learn: you describe a computation and the engine decides how to run it, which is closer to SQL than to pandas.

Series and frames, then expressions, filtering, aggregation, reshaping and joins. Text, lists and structs get their own set because nested data is where Polars pulls ahead. Then time series, and the lazy API with its query optimizer, which is the reason to be here at all.

Start this tour

Series & frames

  • SeriesA Polars Series is a typed, named column backed by Arrow memory.
  • Polars DataFramesBuilding a DataFrame and inspecting it.
  • Reading CSVread_csv loads eagerly; scan_csv defers so the query planner can help.
  • Types and castingPolars types are explicit: cast deliberately, and strict by default.

Expressions

Filtering & sorting

Aggregation

Reshaping & joining

Text, lists & structs

Time series

  • Dates and timesThe dt namespace does the temporal work, on real Date and Datetime types.
  • Grouping over timegroup_by_dynamic buckets rows by a time window, like a resample.

Lazy & SQL

Reading & writing

Encore

The other Python tours