Learn by fixing tests
© 2025-2026 Alex Cole. All Rights Reserved.
Spark Koans is an independent community tool.
Use window functions to calculate running totals. Replace ___ with the correct code.
___ blanks in the code editor with the correct PySpark code, then hit Run Code. Stuck? Try the Hint button.from pyspark.sql.window import Window
from pyspark.sql.functions import sum as spark_sum, col
data = [
("2024-01-01", 100),
("2024-01-02", 150),
("2024-01-03", 200),
("2024-01-04", 175)
]
df = spark.createDataFrame(data, ["date", "sales"])Output will appear here...