val trans = df.groupBy("userId").agg(collect_list("movieId") as "features")
How do I aggregate other columns in the dataFrame as well? For now It is only aggregating column MovieID.
val trans = df.groupBy("userId").agg(collect_list("movieId") as "features")
How do I aggregate other columns in the dataFrame as well? For now It is only aggregating column MovieID.
You can add other aggregation like below example
val trans = df.groupBy("userId").agg(collect_list("movieId") as "features",avg("rating") as "avg_rating"))