I am new to Spark and need a help with transposing the below input dataframe into the desired output df
(Rows to Columns) using PySpark or Spark Sql.
Input Dataframe-
A B C D
1 2 3 4
10 11 12 13
......
........
Required Output (transposed) data
A 1
B 2
C 3
D 4
A 11
B 12
C 13
D 14
....
......
It is better if I can pivot the input data (columns) as per our requirement.