PySpark Koans

Learn by fixing tests

Progress0/39

© 2025-2026 Alex Cole. All Rights Reserved.

Spark Koans is an independent community tool.

Delta LakeKoan 107

Delete with Condition

Delete rows from a Delta table based on a condition. Replace ___ with the correct code.

How it works: Replace the ___ blanks in the code editor with the correct PySpark code, then hit Run Code. Stuck? Try the Hint button.
Setup (read-only)
_reset_delta_tables()

data = [("Alice", 100, True), ("Bob", 200, False), ("Charlie", 150, True)]
df = spark.createDataFrame(data, ["name", "balance", "is_active"])
df.write.format("delta").save("/data/accounts")
Your CodeCtrl/Cmd+Enter to run
Output
Output will appear here...