Skip to content
Advertisement

Pivot rows in a different way using MySQL or SparkDataframe

I have a table like this,I am doing normal pivoting,which is not giving the desired result.

I want to get it in this way:

I tried doing it like this :

But its not giving as expected. Can any one suggest what can be done for the desired result ?

Normal SQL / DF solution both will be helpful.

Advertisement

Answer

Perhaps this is helpful-

pivot + arrays_zip

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement