DS / ML2026.03.29 · 05 min read

Pandas vs Polars: a
practical comparison.

I ran the same workload — a 3-million-row dataset and a real analytical task — through both libraries. The results were not what the benchmark charts suggest.

§1 Why run this at all

Polars benchmarks circulate constantly, usually showing 5-10x speedups over Pandas on synthetic joins and group-bys. Synthetic benchmarks are useful for library authors and nearly useless for deciding what to use on Tuesday. So I picked a real analytical task — a 3-million-row ad performance export — and ran it through both, end to end, including the parts the benchmarks don't measure.

§2 The setup

The task: load a messy CSV export, clean and type-cast 22 columns, join against a 400k-row campaign metadata table, compute rolling 7-day metrics per campaign, and pivot into a reporting shape. I ran each library's idiomatic approach — not a line-by-line port of one into the other's syntax, since that defeats the point.

§3 What the benchmarks say vs what I saw

Polars was faster — but not by the 8-10x figure quoted in most marketing material. On this workload the gap was closer to 2.3x end to end, and most of that gap came from two operations: the join and the rolling-window computation. The CSV load and pivot stages were within noise of each other.

Loading chart…
End-to-end runtime by pipeline stage — same 3M-row workload, idiomatic code in each library. Hover a bar for the exact timing.
Context

The biggest variable wasn't the library — it was how "messy" the source data was. Type inference and string cleanup ate a large share of total runtime in both libraries, and that part scales with data quality, not engine choice.

§4 Where Polars genuinely wins

  • Lazy evaluation makes multi-step pipelines easier to optimise without manual chaining tricks
  • Memory usage was noticeably lower on the join-heavy stage
  • Expression API encourages a style that's easier to parallelise later

§5 Where Pandas still wins

  • Ecosystem — visualisation, statistical, and ML libraries assume Pandas-shaped data
  • Tenured team familiarity; switching costs are real and easy to underestimate
  • Edge-case string and datetime handling, where Pandas' maturity still shows

§6 Verdict

For new, performance-sensitive pipelines, I'd reach for Polars first. For existing analytical codebases with heavy ecosystem dependencies, the migration cost likely outweighs a 2x runtime gain — profile first, then decide whether the bottleneck is even in the dataframe layer at all.