I have a dataframe with the following schema :
root
|-- first_name: string
|-- last_name: string
|-- details: array
| |-- element: struct
| | |-- university: string
| | |-- subjects: struct
| | | |-- subject1: string
| | | |-- subject2: string
|-- grades: array
| |-- element: struct
| | |-- sem1: string
| | |-- sem2: struct
and I want to flatten it to the following schema so that i don't have any structs anymore, I have arrays as independent columns instead.
root
|-- first_name: string
|-- last_name: string
|-- details.university: array
|-- element: string
|-- details.subjects.subject1: array
|-- element: string
|-- details.subjects.subject2: array
|-- element: string
|-- grades.sem1: array
|-- element: string
|-- grades.sem2: array
|-- element: string
I am struggling to do the same and I'd really appreciate some help with this. Thank you!