learning-it by example

Back to the video

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

  1. 0:00 One report, two libraries: South hit 6,814.5 in both
  2. 0:34 The idea
  3. 1:03 Setup
  4. 1:25 The made-up orders
  5. 1:50 The pandas version
  6. 2:16 The Polars version
  7. 2:47 Run both, and the lazy one
  8. 3:48 The trap: row order
  9. 4:22 What this does not show
  10. 4:49 Mistakes to avoid
  11. 5:23 My take and next steps
  12. 5:49 Recap

Files

  • data.py (17 lines)
  • pandas_way.py (13 lines)
  • polars_way.py (14 lines)
  • run.py (21 lines)

Download the code (zip)

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

Learning IT by Example.