val trans = df.groupBy("userId").agg(collect_list("movieId") as "features")
如何在dataFrame中聚合其他列?目前,它仅聚合MovieID列。
答案 0 :(得分:0)
您可以添加其他聚合,例如下面的示例
val trans = df.groupBy("userId").agg(collect_list("movieId") as "features",avg("rating") as "avg_rating"))