The Daily Grind wants a takings-per-store summary.
You have the orders DataFrame:
Your task: return each store and a column total_revenue — the sum of amount for that store.
Assign your answer DataFrame to result. Row order doesn't matter.
Practice / aggregations
The Daily Grind wants a takings-per-store summary.
You have the orders DataFrame:
Your task: return each store and a column total_revenue — the sum of amount for that store.
Assign your answer DataFrame to result. Row order doesn't matter.
ordersinput DataFrame| column | type |
|---|---|
| order_id | long |
| store | string |
| amount | double |
| order_id | store | amount |
|---|---|---|
| 1 | Downtown | 5 |
| 2 | Downtown | 7 |
| 3 | Pier | 4 |
| 4 | Pier | 6 |
| 5 | Pier | 2 |
storetotal_revenue· 2 rowsgroupBy("store") then agg(F.sum("amount").alias("total_revenue")).
This problem builds on Aggregations & groupBy (~7 min). Pop it open in a new tab if you want a quick recap.