Is there a way to transform a org.apache.spark.sql.DataFrame like this
Predictor icaoCode num1 num2
P1 OTHH 1.1 1.2
P1 ZGGG 2.1 2.2
P2 OTHH 3.1 3.2
P2 ZGGG 4.1 4.2
P3 OTHH 5.1 5.2
P3 ZGGG 6.1 6.2
. . . .
. . . .
. . . .
into a DataFrame like this?
icaoCode P1.num1 P1.num2 P2.num1 P2.num2 P3.num1 P3.num2 ...
OTHH 1.1 1.2 3.1 3.2 5.1 5.2 ...
ZGGG 2.1 2.2 4.1 4.2 6.1 6.2 ...
. . . . . . . ...
. . . . . . . ...
. . . . . . . ...
There can be an arbitrary number of values for Predictor and for icaoCode.