I have a PySpark dataframe with a column results. Inside the results column I want to remove the column "Attributes".
The schema of the dataframe (there are more columns, but I have not shown them for convenience because the schema is large):
|-- results: struct (nullable = true)
| |-- l: array (nullable = true)
| | |-- element: struct (containsNull = true)
| | | |-- m: struct (nullable = true)
| | | | |-- Attributes: struct (nullable = true)
| | | | | |-- m: struct (nullable = true)
| | | | | | |-- Score: struct (nullable = true)
| | | | | | | |-- n: string (nullable = true)
| | | | |-- OtherInfo: struct (nullable = true)
| | | | | |-- l: array (nullable = true)
| | | | | | |-- element: struct (containsNull = true)
| | | | | | | |-- m: struct (nullable = true)
| | | | | | | | |-- Name: string (nullable = true)
How to do this without a udf in PySpark?
One row of data:
{
"results" : {
"l" : [
{
"m":{
"Attributes" : {
"m" : {
"Score" : {"n" : "85"}
}
},
"OtherInfo":{
"l" : [
{
"m" : {
"Name" : {"john"}
}
},
{
"m" : {
"Name" : "Cena"}
}
]
}
}
}
]
}
}