Assembly Line

Instead of pandas: Polars

Use Polars instead of pandas for new data work. It is several times faster, uses far less memory, and its lazy API optimises a whole query before running it. Keep pandas where libraries you depend on expect a pandas DataFrame.

Old pandas ★ 50k BSD-3-Clause Python Pushed today pandas.pydata.org
Instead Polars ★ 40k MIT Rust Pushed today pola.rs

Both are for working with tabular data in Python.

Why Polars is better

  • Wikipedia, citing comparisons, puts Polars at 5 to 10 times faster than pandas on similar tasks, using all CPU cores where pandas mostly uses one.
  • pandas needs around 5 to 10 times the dataset size in RAM, against 2 to 4 times for Polars, so larger files fit on the same machine.
  • Polars plans a whole query and pushes filters and column selection down into the file scan, which pandas, being eager only, cannot do.
  • Polars has no index and uses expressions, which removes a whole class of pandas surprises around index alignment and chained assignment.

When to keep pandas

Keep pandas when your plotting, statistics or machine learning libraries take pandas DataFrames, when you rely on its index for time series work, or when a codebase is large and working. pandas is still actively released, now at version 3.1.1.

Switching

This is a rewrite, not a drop-in. The syntax differs: no index, expressions instead of column assignment, and no chained indexing. Polars' migration guide maps the common pandas idioms. Convert at the edges with to_pandas() and from_pandas() so you can move one pipeline at a time.

Watch out

Some libraries still accept only pandas objects, so you will convert at boundaries. Polars is developed by a venture-funded company, though the library is MIT-licensed. Code written for pandas habits, such as row-by-row apply, gains little until it is rewritten as expressions.

Also worth a look

  • DuckDB An in-process SQL database that queries files and DataFrames directly; pick it if your team thinks in SQL.

More newer, better dataframe libraries and notebooks

Sources

Judged on 2026-11-06. See every dataframe libraries and notebooks, or all 66 replacements.