Transform raw sales records into a product-major pivot table with monthly totals.
Constraints
Example
>>> pivot_sales([
... {'product': 'apple', 'month': '2024-01', 'amount': 10},
... {'product': 'banana', 'month': '2024-01', 'amount': 5},
... {'product': 'apple', 'month': '2024-02', 'amount': 3},
... {'product': 'apple', 'month': '2024-01', 'amount': 7},
... ])
{'apple': {'2024-01': 17, '2024-02': 3}, 'banana': {'2024-01': 5}}
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints