How to pivot on multiple columns in Spark SQL?

后端 未结 3 1295
梦毁少年i
梦毁少年i 2020-12-13 20:01

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         


        
3条回答
  •  我在风中等你
    2020-12-13 20:27

    As in spark 1.6 version I think that's the only way because pivot takes only one column and there is second attribute values on which you can pass the distinct values of that column that will make your code run faster because otherwise spark has to run that for you, so yes that's the right way to do it.

提交回复
热议问题