0

I have DataFrame like this(bat with 200 columns +):

uid sel_type1 sel_type2 sel_type3
123 1         0         1
123 1         1         0
100 0         1         2

and after i use

df.groupBy(col("uid")).sum()

i have something like this:

uid sum(sel_type1) sum(sel_type2) sum(sel_type3)
123 2              1              1
100 0              1              2

Bat i wont this:

uid sel_type1 sel_type2 sel_type3
123 2         1         1
100 0         1         2

How can i do it?

Gumada Yaroslav
  • 115
  • 1
  • 10

1 Answers1

0

As seen here:

df.groupBy(col("uid")).sum().toDF(df.columns:_*)
qaziqarta
  • 1,782
  • 1
  • 4
  • 11