'Pyspark - explode return an empty dataframe when a nested collection has no item
I have the following dataframe
+---------------+--------+
|book_id |Chapters|
+---------------+--------+
|865731 |[] |
+---------------+--------+
when I do the explode
I get an empty dataframe
df.withColumn("Chapters", f.explode("Chapters")).select("*", "Chapters.*").show()
what's wrong in the code above ? Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|