Polars 1.0: the pandas alternative is production-ready
Posted by Bhrigu Rishi · 2024-09-27
Polars hits 1.0. Lazy evaluation, Rust engine, stable API. 10-50x faster than pandas on real workloads. If you're still using pandas for anything over 1GB, you're leaving perf on the table. https://github.com/pola-rs/polars/releases/tag/py-1.0.0
import polars as pl
df = pl.read_parquet('sales_2024.parquet')
monthly = (
df.lazy()
.with_columns(pl.col('date').dt.month().alias('month'))
.group_by('month', 'region')
.agg(
revenue=pl.col('amount').sum(),
orders=pl.len(),
avg_order=pl.col('amount').mean(),
)
.sort('revenue', descending=True)
.collect()
)