Polars 0.19: the pandas replacement I've been waiting for

Posted by Kalindi Devi · 2023-10-13

Polars 0.19 redesigns the expressions API and it's beautiful. Lazy evaluation, Rust engine, 10-50x faster than pandas. My go-to for any data pipeline now. https://github.com/pola-rs/polars

import polars as pl

result = (
    pl.scan_parquet('events.parquet')
    .filter(pl.col('timestamp') > '2023-01-01')
    .group_by('user_id')
    .agg([
        pl.col('event').count().alias('total_events'),
        pl.col('duration_ms').mean().alias('avg_duration'),
    ])
    .sort('total_events', descending=True)
    .collect()
)

Explore GitVibes