# Totals by Week and Month

Totals by Week and Month: Totals by Week and Month: resample.

Updated: November 19, 2026

1. [Totals by Week and Month: resample](https://www.ask-codey.com/lessons/pandas-resample) (Journeyman): Total a column by month with groupby on dt.to_period('M'), and by week with resample('W') on a date index, which labels each week by the Sunday it ends on and keeps every week from the first to the last, so a week with no orders shows as 0 instead of disappearing, while its mean is NaN.

Source: https://www.ask-codey.com/courses/python-data-analysis/topics/data-time-periods
