Practice / aggregations

Store-Day Revenue

medium

The Daily Grind wants revenue broken out by store and day, not just per store.

You have the orders DataFrame:

Your task: return store, day, and revenue (the sum of amount) for every store-and-day combination.

Assign your answer DataFrame to result. Row order doesn't matter.

ordersinput DataFrame

Schema
columntype
storestring
daystring
amountdouble
Sample rows
storedayamount
DowntownMon5
DowntownMon3
DowntownTue4
PierMon6
Expected output shape
storedayrevenue· 3 rows
Hint

Group by both keys at once: groupBy("store", "day"). You get one row per unique store-and-day combination; sum amount into 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.