Fix My Tutorial
Report

Practical Business Python

Open the original tutorial
Fixed Python 3.12 · checked 17 Oct 2026 · model cost $0.024

The tutorial code runs successfully after replacing the deprecated pandas frequency aliases 'M' and 'A-DEC' with 'ME' and 'YE-DEC'; the original error about unsupported offset 'M' was resolved by this change, which is required in pandas 3.0+.

4 changes to make it work today

Resample by month and sum ext price

s3 · run_code migrate

The frequency 'M' is no longer supported in pandas 3.0; the error message directs to use 'ME' instead.

@@ -1 +1 @@
-df.set_index('date').resample('M')['ext price'].sum()
+df.set_index('date').resample('ME')['ext price'].sum()

Sources

Group by name and resample by month

s4 · run_code migrate

Same alias change as step s3; 'M' must become 'ME' for resample to work.

@@ -1 +1 @@
-df.set_index('date').groupby('name')['ext price'].resample("M").sum()
+df.set_index('date').groupby('name')['ext price'].resample('ME').sum()

Sources

Using Grouper for monthly summary by name

s5 · run_code migrate

The Grouper frequency 'M' is deprecated; update to 'ME' for monthly frequency.

@@ -1 +1 @@
-df.groupby(['name', pd.Grouper(key='date', freq='M')])['ext price'].sum()
+df.groupby(['name', pd.Grouper(key='date', freq='ME')])['ext price'].sum()

Sources

Annual summary using Grouper

s6 · run_code migrate

The annual frequency 'A-DEC' is replaced by 'YE-DEC' in pandas 3.0 offset aliases.

@@ -1 +1 @@
-df.groupby(['name', pd.Grouper(key='date', freq='A-DEC')])['ext price'].sum()
+df.groupby(['name', pd.Grouper(key='date', freq='YE-DEC')])['ext price'].sum()

Sources

Tell the author

Send them what broke and the fix, so the next reader doesn't hit the same error.

Badge

Add it to the tutorial so readers know when it was last checked.

Fix My Tutorial badge
Markdown
[![Fix My Tutorial](https://fix-my-tutorial.onrender.com/badge/ri-gwPkO5hr.svg)](https://fix-my-tutorial.onrender.com/r/ri-gwPkO5hr)
HTML
<a href="https://fix-my-tutorial.onrender.com/r/ri-gwPkO5hr"><img src="https://fix-my-tutorial.onrender.com/badge/ri-gwPkO5hr.svg" alt="Fix My Tutorial"></a>