Polars for pandas Users: One Report, Translated
One made-up report in pandas and Polars: same 4 rows, South at 6,814.5 in both.
Video #137 ยท Python for data
Steps in the video
Files
- data.py (17 lines)
- pandas_way.py (13 lines)
- polars_way.py (14 lines)
- run.py (21 lines)
Tested with
Python 3.12.15 | pandas==3.1.0, polars==2.1.0
What this does not show
Made-up data of a thousand rows, five common steps only, and no timing, so it makes no speed or memory claim.
Sources
- https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.group_by.html
- https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.join.html
- https://docs.pola.rs/user-guide/getting-started/
- https://docs.pola.rs/user-guide/migration/pandas/
- https://pypi.org/pypi/pandas/json
- https://pypi.org/pypi/polars/json
Learning IT by Example.