datafarme如下所示:
val df = spark.sparkContext.parallelize(Seq(
("ChannelA", 10, 8, 12),
("ChannelB", 11, 9, 13),
("ChannelC", 12, 10, 14)
)).toDF("Channel", "default", "min", "max")
或
+--------+-------+---+---+
| Channel|default|min|max|
+--------+-------+---+---+
|ChannelA| 10| 8| 12|
|ChannelB| 11| 9| 13|
|ChannelC| 12| 10| 14|
+--------+-------+---+---+
我想要实现的是以下
+----------------+------------+------------+----------------+------------+------------+
|ChannelA_default|ChannelA_min|ChannelA_max|ChannelB_default|ChannelB_min|ChannelB_max|
+----------------+------------+------------+----------------+------------+------------+
| 10| 8| 12| 11| 9| 13|
+----------------+------------+------------+----------------+------------+------------+
把它说成文字。我想要一个新的数据框,其中列名由Channel中的值加上所有其他列的列名组成。这些列应填入适当的值