Query large tables fast with Polars
8 steps · about 2 h 20 min · Beginner
- Load a table and run your first queries (tutorial, Polars, 20 min)
A quick tour of reading, selecting, filtering and grouping shows how Polars code is shaped.
- Know the column types and structures (doc, Polars, 15 min)
Strict column types explain many errors and most of the speed, so learn them early.
- Think in expressions and contexts (doc, Polars, 20 min)
Expressions describe a column computation once and run inside select, with_columns, filter or group_by.
- Derive new columns with arithmetic and comparisons (doc, Polars, 15 min)
Build the everyday calculations and flags that most analyses need.
- Summarise groups (doc, Polars, 20 min)
Grouped aggregations answer questions such as totals per region or averages per month.
- Combine tables with joins (doc, Polars, 20 min)
Bring lookup tables and facts together, and check which join strategy keeps the rows you intend.
- Switch to the lazy API (doc, Polars, 15 min)
Describing the full query before running it lets Polars push down filters and read only needed columns.
- Inspect the optimised query plan (doc, Polars, 15 min)
Reading the plan confirms that filters and projections were pushed down before you trust the speed.