1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Data Transformation with Polars

Connected

Bài tập

Rolling aggregations on multiple columns

What if you need rolling statistics on multiple columns at once? The .rolling() method lets you compute aggregations over a time-based window for several columns simultaneously.

polars is loaded as pl. The DataFrame bikes is available with columns time, rentals, and temp.

Hướng dẫn

100 XP
  • Set up the 3-hour rolling window on the time column.
  • Calculate the sum of rentals and the mean of temp in the aggregation.