Python data engineering interview problem. Difficulty: intermediate. Pattern: Dictionaries. About 15 minutes. Part of the Pro drill bank.
Ops wants open vs shipped orders grouped by customer so a dashboard can show each customer's workload by status.
Group orders by customer and status.
Input: group_orders([{'customer_id': 'U1', 'status': 'paid', 'order_id': 'A'}, {'customer_id': 'U1', 'status': 'paid', 'order_id': 'B'}, {'customer_id': 'U2', 'status': 'pending', 'order_id': 'C'}]) Output: {'U1': {'paid': ['A', 'B']}, 'U2': {'pending': ['C']}} This input follows the stated rules and produces this output.
Topics: lakebench, python, grouping.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Group a flat list of orders into a nested dictionary keyed by customer, then status.
Group orders by customer and status.