Practice / aggregations

Revenue Per Store

easy

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

Schema
columntype
order_idlong
storestring
amountdouble
Sample rows
order_idstoreamount
1Downtown5
2Downtown7
3Pier4
4Pier6
5Pier2
Expected output shape
storetotal_revenue· 2 rows
Hint

groupBy("store") then agg(F.sum("amount").alias("total_revenue")).

Lesson refresher

This problem builds on Aggregations & groupBy (~7 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.