4. Top customer each month
MediumPandas & NumPy
Rows have month (like "2026-01"), customer and amount. For each month, return the customer with the highest total spend. Break ties by customer name. Return [month, customer, total] sorted by month.
Input rows arrive as a list of dictionaries; build a DataFrame with pd.DataFrame(rows).
Example 1
Input: … Output: [['2026-01', 'ana', 120], ['2026-02', 'bo', 90]]
Constraints
Totals are integers