I need to pivot more than one column in a pyspark dataframe. Sample dataframe,
>>> d = [(100,1,23,10),(100,2,45,11),(100,3,67,12),(100,4,78,13),(10
The solution in the question is the best I could get. The only improvement would be to cache the input dataset to avoid double scan, i.e.
cache
mydf.cache pivot_udf(mydf,'price','units').show()