Polars vs Pandas: Where the Speedup Really Comes From
Polars vs pandas after Polars 2.1 and pandas 3.1: tested code, a reproducible benchmark, API and memory differences, and when to use each library.

Polars vs pandas after Polars 2.1 and pandas 3.1: tested code, a reproducible benchmark, API and memory differences, and when to use each library.

Polars wins for ETL pipelines, large files and multi-core machines; pandas wins for notebooks, small data and libraries built on its API. In our test on 8 vCPUs, Polars 2.1 ran filters, group-bys, joins and string searches roughly 5x to 16x faster than pandas 3.1. Pinned to one thread, the gap shrank to between 1x and 2.5x.
That second number matters most. Much of Polars' lead comes from using every core, so the gap you see depends on your hardware and your workload.
str dtype the default, so upgrades already require code changes.Feature | Polars | pandas |
|---|---|---|
Current version (Nov 2026) | ||
Core language | Rust, on Apache Arrow memory | Python and C extensions, on NumPy or Arrow |
Multi-core | Yes, by default | Mostly single-threaded |
Lazy queries with optimizer | Yes ( | No |
Bigger-than-RAM data | Streaming engine, spill-to-disk on by default | No built-in path |
Row index | None | Central to the API |
Missing values |
|
|
License | ||
PyPI downloads, last 30 days | ||
Best for | ETL, large files, production pipelines | EDA, notebooks, pandas-native libraries |
Both libraries need Python 3.11 or newer in their current releases, according to their PyPI metadata.

Polars is a DataFrame library for Python and Rust created by Ritchie Vink. It stores columns in Apache Arrow format and runs its query engine in Rust across all available cores.
You can use it eagerly, like pandas, or lazily. A lazy query (pl.scan_csv(), pl.scan_parquet(), df.lazy()) builds a plan first. When you call .collect(), the optimizer pushes filters into the file reader and skips columns the query never uses.
Polars reached version 1.0 on July 1, 2024. The company behind it raised a €18M Series A led by Accel in September 2025. Its paid distributed platform, formerly Polars Cloud, was renamed Polars Nanook on November 5, 2026; the open-source library stays MIT-licensed.
Polars 2.0 shipped on October 6, 2026, and Polars 2.1 followed on October 27. The changes that matter for a pandas comparison:
LazyFrame.collect() now uses the streaming engine by default.join and group_by. Sort explicitly, or pass maintain_order=True, when order matters..loc, .iloc and index alignment needs rewriting, not renaming.
pandas is an open-source data analysis and manipulation library built on Python. Its development began at AQR Capital Management in 2008, it was open-sourced by the end of 2009, and it has been a NumFOCUS sponsored project since 2015.
Its labeled index, .loc/.iloc selection and deep integration with NumPy and Matplotlib made it the default for data work in Python. Pandas still sees roughly ten times the monthly PyPI downloads of Polars.
pandas 3.0 shipped on January 21, 2026, and pandas 3.1 on October 22. Two defaults changed:
df["col"][mask] = value never updates the original DataFrame.str dtype. String columns are inferred as str instead of object, backed by PyArrow when it is installed. Checks like dtype == "object" stop matching.The release also removed include_groups=True from DataFrameGroupBy.apply(). Note that DataFrame.append() was already removed in pandas 2.0.
.describe() and .plot() make quick exploration easy.Headline speedups range from single digits to 94x because they measure different things. Here is what each number means, and a benchmark you can run yourself.
The official PDS-H benchmark from May 2025 ran on an AWS c7a.24xlarge with 96 vCPUs. At scale factor 10 (roughly 10 GB of CSV), Polars 1.30 streaming took 3.89 seconds against 365.71 seconds for pandas 2.2.3: 94x.
Pandas was left out of the scale factor 100 run because of out-of-memory failures. The result is real, but it reflects 96 cores, a TPC-H style query suite and pandas 2.2.
To see the effect on a smaller machine, we timed four common operations on 5 million rows. Install the pinned versions first:
pip install "polars==2.1.0" "pandas==3.1.1" "pyarrow==26.0.1" "scikit-learn==1.9.1"Save this as bench.py:
import time
import numpy as np
import pandas as pd
import polars as pl
N = 5_000_000
rng = np.random.default_rng(42)
data = {
"user_id": rng.integers(0, 100_000, N),
"amount": rng.random(N) * 100,
"country": rng.choice(["LT", "ES", "US", "DE", "FR"], N),
"email": [f"user{i % 100_000}@example.com" for i in range(N)],
}
users = {"user_id": np.arange(100_000), "tier": rng.choice(["free", "pro"], 100_000)}
pdf, pusers = pd.DataFrame(data), pd.DataFrame(users)
pldf, plusers = pl.DataFrame(data), pl.DataFrame(users)
def best_of(fn, runs=3):
times = []
for _ in range(runs):
start = time.perf_counter()
fn()
times.append(time.perf_counter() - start)
return min(times)
tasks = {
"filter": (
lambda: pdf[pdf["amount"] > 50],
lambda: pldf.filter(pl.col("amount") > 50),
),
"group-by": (
lambda: pdf.groupby("country")["amount"].agg(["sum", "mean", "max"]),
lambda: pldf.group_by("country").agg(
pl.col("amount").sum().alias("sum"),
pl.col("amount").mean().alias("mean"),
pl.col("amount").max().alias("max"),
),
),
"join": (
lambda: pdf.merge(pusers, on="user_id"),
lambda: pldf.join(plusers, on="user_id"),
),
"string contains": (
lambda: pdf[pdf["email"].str.contains("99@", regex=False)],
lambda: pldf.filter(pl.col("email").str.contains("99@", literal=True)),
),
}
for name, (pandas_fn, polars_fn) in tasks.items():
t_pd, t_pl = best_of(pandas_fn), best_of(polars_fn)
print(f"{name:<16} pandas {t_pd:6.3f}s polars {t_pl:6.3f}s {t_pd / t_pl:5.1f}x")One run on an 8 vCPU Linux box with 15 GB of RAM, Python 3.15.2, printed:
filter pandas 0.096s polars 0.008s 11.9x
group-by pandas 0.133s polars 0.010s 13.8x
join pandas 0.153s polars 0.030s 5.1x
string contains pandas 0.166s polars 0.013s 12.8xYour timings will differ. Across five runs, the median speedups were 11x for the filter, 13x for the group-by, 5x for the join and 13x for the string search.
Now pin Polars to one thread with POLARS_MAX_THREADS=1 python bench.py. Over five runs, the medians fell to 2.4x for the filter, 2.2x for the group-by, 1.0x for the join and 2.5x for the string search.
On one core, Polars is still faster at filtering, grouping and string search, and the join is a draw. Most of the double-digit gains come from parallelism, so a laptop with 4 cores will see less than a 96-core server.
The string result is also a pandas 3 story. With PyArrow installed, string columns now use the Arrow-backed str dtype, so old benchmarks that showed little gain on string work measured the object dtype.
A VU Amsterdam study points the same way on energy. Polars used about 8 times less energy than pandas on large synthetic dataframes and about 63% of pandas' energy on TPC-H tasks with large dataframes.
Winner: Polars. It led on every operation we tested with 8 threads, and the lead grows with core count.
The two APIs look similar for simple selects, then split on three points: Polars has no row index, its DataFrames are never modified in place, and it replaces most .apply() calls with expressions.
Here is the same per-group calculation in both libraries: the highest views value among rows whose sales beat their group's average.
import pandas as pd
import polars as pl
data = {
"id": [1, 1, 1, 2, 2, 2],
"sales": [10, 20, 30, 5, 50, 45],
"views": [100, 250, 300, 80, 900, 700],
}
# pandas: a Python function runs once per group
pdf = pd.DataFrame(data)
pd_result = pdf.groupby("id")[["sales", "views"]].apply(
lambda d: d.loc[d["sales"] > d["sales"].mean(), "views"].max()
)
print(pd_result)
# Polars: one expression, evaluated in Rust
pldf = pl.DataFrame(data)
pl_result = (
pldf.group_by("id")
.agg(pl.col("views").filter(pl.col("sales") > pl.col("sales").mean()).max())
.sort("id")
)
print(pl_result)Both return 300 for group 1 and 900 for group 2:
id
1 300
2 900
dtype: int64
shape: (2, 2)
┌─────┬───────┐
│ id ┆ views │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═══════╡
│ 1 ┆ 300 │
│ 2 ┆ 900 │
└─────┴───────┘The .sort("id") is there on purpose. Polars does not promise group order, so sort whenever output order matters.
Common renames when you move code across:
pandas | Polars |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
| An expression, or |
The official Coming from pandas guide lists the semantic differences, including null versus NaN.
Winner: Tie. pandas is quicker to poke at in a notebook. Polars expressions are easier to reason about in production code and run in parallel.
If you stay on pandas, the 3.x defaults still change how your code behaves. This snippet shows both changes:
import pandas as pd
df = pd.DataFrame({"city": ["Vilnius", "Madrid"], "temp_c": [3, 14]})
print(df["city"].dtype)
print(df["city"].dtype == "object")
df["temp_c"][df["city"] == "Madrid"] = 20 # chained assignment
print(df["temp_c"].tolist())
df.loc[df["city"] == "Madrid", "temp_c"] = 20 # one indexing step
print(df["temp_c"].tolist())With pandas 3.1.1 it prints:
str
False
[3, 14]
[3, 20]The chained assignment also emits a ChainedAssignmentError warning and leaves the data unchanged. The single .loc assignment works. Polars avoids the whole class of problem because you always build a new DataFrame with with_columns().
Polars' biggest structural advantage is the lazy API. You describe the whole query, and Polars decides what to read:
import polars as pl
pl.DataFrame(
{
"order_date": ["2026-01-05", "2026-02-11", "2026-03-02", "2026-03-09"],
"region": ["EU", "US", "EU", "US"],
"amount": [120.0, 80.0, 200.0, 40.0],
}
).write_csv("orders.csv")
lf = (
pl.scan_csv("orders.csv", try_parse_dates=True)
.filter(pl.col("order_date") >= pl.date(2026, 2, 1))
.group_by("region")
.agg(pl.col("amount").sum().alias("revenue"))
.sort("region")
)
print(type(lf).__name__)
print(lf.collect())Output:
LazyFrame
shape: (2, 2)
┌────────┬─────────┐
│ region ┆ revenue │
│ --- ┆ --- │
│ str ┆ f64 │
╞════════╪═════════╡
│ EU ┆ 200.0 │
│ US ┆ 120.0 │
└────────┴─────────┘Nothing is read until .collect(). Call lf.explain() before collecting and the plan shows the date filter inside the CSV scan, so rows that fail it never reach the group-by.
In Polars 2, .collect() runs on the streaming engine. It can spill to disk once memory use passes about 80% of RAM. pandas loads the whole file into memory first; for data larger than RAM you chunk it yourself.
Winner: Polars. Lazy plans, streaming and spill-to-disk have no built-in pandas equivalent.
pandas still has the wider ecosystem, but the gap is smaller than it was.
set_output(transform="polars") since 1.4. In our test, scikit-learn 1.9.1 also fit a model directly on a Polars DataFrame and kept the column names.to_torch() method.The hard gaps are libraries built on pandas itself. GeoPandas' GeoDataFrame is a subclass of pandas.DataFrame, so geospatial work still runs through pandas. The Polars team said in the 2.0 release that it has started work on GeoPolars.
Moving data between the two is cheap. pl.from_pandas(df) and df.to_pandas(use_pyarrow_extension_array=True) share Arrow buffers when the types allow it, though the Polars team notes some schemas still trigger a partial copy.
Winner: pandas. It still works with more libraries out of the box, especially in geospatial and statistics.
A pandas to Polars move is a rewrite, not a find-and-replace. The usual work:
.loc, .iloc, set_index() and reset_index() logic, since Polars has no index.apply() with expressions for pl.scan_ and add one .collect()` at the endNaN and null should differsort() or maintain_order=True where row order mattersThe Polars team's own migration guide recommends starting with one segment that has a measurable problem, such as a job that runs out of memory. Capture its input and output, rewrite it, and check the result with polars.testing.assert_frame_equal.
The same post reports that Check Technologies migrated more than 100 Airflow DAGs in under two weeks and cut its cloud bill by 25%. These are company-reported figures.
On r/Python, u/GunZinn described a common first encounter: "I was parsing a 4GB csv file last week. Polars was nearly 18x faster than using pandas."
Winner: Tie. New projects pay no migration cost with Polars. Large pandas codebases face real work, but pandas 3 upgrades already force you to touch chained assignment and string checks.
You do not have to choose one library for the whole stack. A common pattern is Polars for the heavy transforms and a single conversion at the edge where a library needs pandas:
import polars as pl
from sklearn.linear_model import LogisticRegression
events = pl.DataFrame(
{
"user_id": [1, 1, 2, 2, 3, 3, 4, 4],
"minutes": [5.0, 7.0, 40.0, 35.0, 3.0, 2.0, 50.0, 45.0],
"pages": [2, 3, 12, 10, 1, 1, 15, 14],
}
)
labels = pl.DataFrame({"user_id": [1, 2, 3, 4], "upgraded": [0, 1, 0, 1]})
# Heavy lifting in Polars
features = (
events.lazy()
.group_by("user_id")
.agg(
pl.col("minutes").mean().alias("avg_minutes"),
pl.col("pages").sum().alias("total_pages"),
)
.join(labels.lazy(), on="user_id")
.sort("user_id")
.collect()
)
print(features)
# scikit-learn accepts the Polars DataFrame directly
X = features.select("avg_minutes", "total_pages")
y = features["upgraded"]
model = LogisticRegression().fit(X, y)
print(model.feature_names_in_)
print(model.predict(X))
# Libraries that still need pandas get one conversion at the boundary
pdf = features.to_pandas(use_pyarrow_extension_array=True)
print(type(pdf).__name__, pdf["avg_minutes"].dtype)Output with scikit-learn 1.9.1:
shape: (4, 4)
┌─────────┬─────────────┬─────────────┬──────────┐
│ user_id ┆ avg_minutes ┆ total_pages ┆ upgraded │
│ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ f64 ┆ i64 ┆ i64 │
╞═════════╪═════════════╪═════════════╪══════════╡
│ 1 ┆ 6.0 ┆ 5 ┆ 0 │
│ 2 ┆ 37.5 ┆ 22 ┆ 1 │
│ 3 ┆ 2.5 ┆ 2 ┆ 0 │
│ 4 ┆ 47.5 ┆ 29 ┆ 1 │
└─────────┴─────────────┴─────────────┴──────────┘
['avg_minutes' 'total_pages']
[0 1 0 1]
DataFrame double[pyarrow]Double River, a quantitative hedge fund, took the idea further in a Polars case study. Moving one model's regressions from statsmodels into a Polars plugin cut a daily run from about 120 minutes to 9 minutes and memory from about 75 GB to 42 GB.
For more Polars patterns, see our Polars Python guide. If you are weighing other engines too, our list of pandas alternatives covers DuckDB, PySpark and more.
Choose Polars if you are starting a new pipeline, your data runs from hundreds of megabytes to beyond RAM, your jobs are heavy on joins and group-bys, or you run on many cores.
Choose pandas if you have a large pandas codebase, depend on GeoPandas or other pandas-native libraries, or mostly explore small datasets in notebooks.
Choose both if you want Polars speed for transforms and pandas compatibility at a few boundaries. Convert once at each boundary, not inside loops. For the wider workflow, see our Python data analysis guide.

Learn LangGraph from scratch: state, nodes, edges, checkpointing, human approval and multi-agent patterns, with tested code and when NOT to use it.

Jaccard similarity in Python with sets, sklearn, SciPy, NumPy and MinHash. Tested code, the SciPy distance footgun, real benchmarks and a decision table.

The Python GIL is a CPython mutex: one OS thread runs bytecode at a time. Default 3.14 still has it; 3.14t is supported opt-in.