Python
All Top 50 Python & Pandas Interview Questions#44
Calculate Month-over-Month Growth with pct_change() in Pandas
EasyPwCInterview Question #44
Asked at PwCGiven monthly revenue records, calculate Month-over-Month (MoM) revenue percentage change `mom_growth_pct` rounded to 2 decimal places.
Input Table: monthly_rev
3 rows preview| month | revenue |
|---|---|
| 2026-01 | 100000 |
| 2026-02 | 125000 |
| 2026-03 | 118750 |
Expected Output Structure3 rows
| month | revenue | mom_growth_pct |
|---|---|---|
| 2026-01 | 100000 | NULL |
| 2026-02 | 125000 | 25 |
| 2026-03 | 118750 | -5 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Click "Run & Test" to execute your Pandas code against the test assertions.