I have a DataFrame with a single column which is an array of structs
df.printSchema()
root
|-- dataCells: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- label: string (nullable = true)
| | |-- value: string (nullable = true)
Some sample data might look like this:
df.first()
Row(dataCells=[Row(label="firstName", value="John"), Row(label="lastName", value="Doe"), Row(label="Date", value="1/29/2018")])
I'm trying to figure out how to reformat this DataFrame by turning each struct into a named column. I want to have a DataFrame like this:
------------------------------------
| firstName | lastName | Date |
------------------------------------
| John | Doe | 1/29/2018 |
| .... | ... | ... |
I've tried everything I can think of but haven't figured this out.