Analyze Recent Orders Dataset with Python/pandas
RobloxData Scientist · OnsiteLast updated
This question evaluates proficiency in data manipulation and aggregation using Python/pandas, including extracting per-user maximums, computing overall summary statistics, and producing daily aggregates from time-stamped records.
orders
| order_id | user_id | price | created_at |
|---|---|---|---|
| 1 | 101 | 20.5 | 2024-01-01 |
| 2 | 101 | 35.0 | 2024-01-03 |
| 3 | 102 | 15.0 | 2024-01-02 |
| 4 | 103 | 50.0 | 2024-01-04 |
| 5 | 102 | 25.0 | 2024-01-05 |
Scenario
E-commerce analytics team needs quick Python insights on recent orders dataset.
Question
Using Python/pandas: a) For every user, return the order_id with the maximum price. b) Compute the overall average order price. c) For each calendar day, report total orders and average price.
Hints
Think groupby, idxmax, agg, reset_index.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.