Optimize a Delta table for better query performance. 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()
# Create table with data
data = [(i, f"user_{i}", i % 10) for i in range(100)]
df = spark.createDataFrame(data, ["id", "name", "category"])
df.write.format("delta").save("/data/users")