spark dstaframe 多字段统计

val aggCols = List("Pclass","Age","Fare")
                .map(colName=>functions.avg(colName).as("avg_"+colName))
df.groupBy("Survived").agg(aggCols.head,aggCols.tail:_*).show()

posted @ 2021-07-17 17:49  real-zhouyc  阅读(73)  评论(0编辑  收藏  举报