1

I have 2 different files and make it both of it with different dataframes. However, when I tried to concat the dataframes and calculate the groupby.sum(), the output was like this:

df['total point'] = df.groupby(['submitter'])['total point'].sum()

Data:

  submitter  total_point
0   jackson            5
1   jackson           10
2    ariana            5
3    ariana            0
4     shawn           15  

When I tried to concat and groupby.sum() with same dataframes, it works :(

mcskinner
  • 2,620
  • 1
  • 11
  • 21
  • `df.groupby(...)[...].sum()` has a different structure, e.g. length and idex, than `df`. You can't assign the former as a column of `df`. – Quang Hoang Apr 16 '20 at 03:39
  • i noticed that one of the dataframe for column name consists of " " that unable it to groupby. Thank you! – Athirah Omar Jun 17 '20 at 03:52

0 Answers0