Skip to content
RED SAGSkills
medium10 pts · first answer countssparkspark-window-functions

A 7-row rolling sum

Each store has exactly one row per day. Which frame gives a rolling sum of the current day and the 6 days before it?

w = Window.partitionBy("store").orderBy("day")
df.withColumn("sum_7d", F.sum("sales").over(w.???))
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions