更新时间:2023-02-05 18:24:44
使用 df.select(cols.head, cols.tail: _*)
让我知道它是否有效:)
Let me know if it works :)
key是select的方法签名:
The key is the method signature of select:
select(col: String, cols: String*)
cols:String*
条目采用可变数量的参数.:_*
解包参数,以便它们可以被这个参数处理.非常类似于在 python 中使用 *args
解包.请参阅此处和此处 其他示例.
The cols:String*
entry takes a variable number of arguments. :_*
unpacks arguments so that they can be handled by this argument. Very similar to unpacking in python with *args
. See here and here for other examples.