Learn by fixing tests
© 2025-2026 Alex Cole. All Rights Reserved.
Spark Koans is an independent community tool.
Expand array columns into multiple rows. 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.functions import explode, split, col
data = [("Alice", "python,sql,spark"), ("Bob", "java,scala")]
df = spark.createDataFrame(data, ["name", "skills_str"])
# First split the string into an array
df = df.withColumn("skills", split(col("skills_str"), ","))Output will appear here...