Given orders(order_id, user_id, amount), compute a cumulative sum of amount per user_id ordered by order_id. Return user_id, order_id, amount, running_total sorted by user_id asc, order_id asc. Round to 2 decimals.
| order_id | user_id | amount |
|---|---|---|
| 1 | 3 | 64.57 |
| 2 | 3 | 25.61 |
| 3 | 3 | 96.67 |
| 4 | 1 | 37.55 |
| 5 | 2 | 65.22 |
| 6 | 1 | 82.34 |
These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].
orders8 rows| order_id (int) | user_id (int) | amount (double) |
|---|---|---|
| 1 | 3 | 64.57 |
| 2 | 3 | 25.61 |
| 3 | 3 | 96.67 |
| 4 | 1 | 37.55 |
| 5 | 2 | 65.22 |
| 6 | 1 | 82.34 |
| 7 | 3 | 46.04 |
| 8 | 3 | 87.64 |
Column names and order must match. Sort order is specified in the question.