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

Connected

Bài tập

Calculating weekly rental totals

Beyond filtering, you often need to aggregate data by time periods. To spot trends across July and compare week-over-week demand, calculate weekly rental totals.

polars is loaded as pl. The DataFrame bikes is available, sorted by time.

Hướng dẫn

100 XP
  • Group the data by week using group_by_dynamic().
  • Calculate the sum of rentals and name it total_rentals.