Loading...
The Pandas Pivot
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid, senior
Problem
Given a list of event records, each with a user ID, event type, and integer amount, pivot the data so each user has one row and each event type becomes a column. Values should be the sum of amounts for that user and event type. Return a list of dicts representing the pivoted rows, sorted by user ID.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.