Guest User

Untitled

a guest
Sep 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. //inputDataFrame
  2. +---+------+----------+
  3. |age| name|occupation|
  4. +---+------+----------+
  5. | []|Harish| developer|
  6. +---+------+----------+
  7.  
  8. df.withColumn("age",explode(col("age")))
  9.  
  10. //DataFrame with age column exploded
  11. +---+----+----------+
  12. |age|name|occupation|
  13. +---+----+----------+
  14. +---+----+----------+
  15.  
  16. // expected DataFrame
  17. +---+------+----------+ +----+------+----------+
  18. |age| name|occupation| |age | name|occupation|
  19. +---+------+----------+ (or)+----+------+----------+
  20. | |Harish| developer| |null|Harish| developer|
  21. +---+------+----------+ +----+------+----------+
Add Comment
Please, Sign In to add comment