Use the "D"
offset rather than "M"
and specifically use "30D"
for 30 days or approximately one month.
df = df.rolling("30D").sum()
Initially, I intuitively jumped to using "M"
as I figured it stands for one month, but now it’s clear why that doesn’t work.