pandas vs Polars vs FireDucks
Read a little, play a little. No scary maths, and no rush.
Last reviewed: October 2026 · report an issue
The one-line verdict
- Learn pandas first. Every job, tutorial, and library (scikit-learn, matplotlib) speaks it.
- Slow pandas on Linux? Try FireDucks — same code, faster. Change one import.
- New pipeline where speed is the whole point? Consider Polars — fastest, but you rewrite in its API.
How they differ
| pandas | FireDucks | Polars | |
|---|---|---|---|
| API | The standard | pandas-compatible (drop-in) | Its own (lazy + eager) |
| Speed trick | Single-threaded | JIT compile + multithreading | Rust + query optimizer |
| Code changes | — | import fireducks.pandas as pd |
Rewrite queries |
| Platform | Everywhere | Linux x86_64 wheels | Everywhere |
| Ecosystem | Everything | Works with libs expecting pandas frames | Growing, separate |
Official homes: pandas · Polars · FireDucks (GitHub).
Choosing in 30 seconds
- Learning or working with others' code? pandas.
- Existing pandas code on Linux that is too slow? Try FireDucks first; it costs one line.
- New, performance-critical pipeline, or data near your memory limits? Polars.
Using FireDucks (2 ways)
# 1. Explicit import — swap one line
import fireducks.pandas as pd
df = pd.read_csv("data.csv")
print(df.groupby("city")["sales"].sum())
# 2. Import hook — run any pandas script untouched
python3 -m fireducks.pandas your_script.py
pip install fireducks # Linux x86_64, Python 3.9–3.12
One job, three ways
Task: total sales by city and month from a large CSV of transactions.
- pandas reads the whole file into memory on one core, then groups. Familiar and readable, and the slowest of the three on big files.
- FireDucks runs the identical pandas code with the import swapped, compiling and multithreading the work behind the scenes. You change nothing but the import.
- Polars expresses it as a lazy query:
import polars as pl
out = (
pl.scan_csv("sales.csv")
.group_by(["city", "month"])
.agg(pl.col("amount").sum())
.collect()
)
Because the query is lazy, Polars sees the whole plan before running it and can read only the columns it needs. That kind of optimization is where much of its speed comes from.
Memory matters as much as speed
pandas loads the entire dataset into memory, and intermediate steps often need several times the file's size. A file that fits on disk can still crash a laptop. Polars' lazy queries read only the needed columns and rows, and its streaming mode can process some datasets larger than memory. Before switching, though, try usecols in pandas to load only the columns you need.
Speed up pandas before replacing it
- Vectorize. Replace row loops with column operations.
- Use better types. The
categorytype for repeated strings such as city names saves memory and time, and pandas' Arrow-backed types can help further. - Store data as Parquet, not CSV. It is compressed, typed, and lets you read selected columns quickly.
- Filter early. Drop the rows and columns you do not need as soon as possible, so every later step works on less data.
Often these alone make pandas fast enough, with no migration at all.
Honest limits
- Row-wise
.apply()loops stay slow everywhere — vectorize first, then blame the library. - FireDucks is Linux-only; on Mac/Windows, pandas or Polars it is.
- Polars is genuinely faster on many benchmarks, but migrating an existing pandas codebase costs real days. FireDucks costs one import.
Check your understanding
5 questions · first-try answers earn the most XP
My notes
Saved in this browser. Highlight a line above and save it, or write it in your own words.
Nothing saved yet. Your highlights will live here.
References
Finished reading?
Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.
Related chapters
Spotted a mistake or want a topic covered? Report an issue