I did A groupby on my column and for some reasons my dataframe looks like this
ID col
1 [item1 -> 2, -> 3, item3 -> 4, -> 5]
2 [item2 -> 1, -> 7, item3 -> 2, -> 7]
I want to remove the KV that have no keys or null key
I want something like this
ID col
1 [item1 -> 2, item3 -> 4, -> 5]
2 [item2 -> 1, item3 -> 2, -> 7]
My Approach
dsNew = ds.withColumn("col", expr("map_filter(col, (k, v) -> k != '')"))
But the map_filter method is not available in PySpark