0

I have a spark dataframe as

enter image description here

with schema

StructType(structField("a",IntegerType,False),structField("b",IntegerType,False),structField("c",ArrayType(structType(structField("d",IntegerType,False),structField("e",IntegerType,False)))

I want to create a separate dataframe from column "c" which is of array type.

Desired output format is

enter image description here

Lamanus
  • 12,898
  • 4
  • 21
  • 47

1 Answers1

1

Try this-

df.selectExpr("a", "b", "inline_outer(c)").show()
Som
  • 6,193
  • 1
  • 11
  • 22