The sales table contains sale amounts by category.
Return the two categories with the highest total revenue as category, revenue. Sort by revenue descending, then category ascending.
These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].
sales7 rows| sale_id (int) | category (string) | amount (double) |
|---|---|---|
| 1 | Books | 20 |
| 2 | Games | 55 |
| 3 | Books | 30 |
| 4 | Home | 40 |
| 5 | Games | 10 |
| 6 | Home | 5 |
| 7 | Books | 5 |
Column names and order must match. Sort order is specified in the question.