0

I have a dataframe having 1K rows, I want to combine the rows having same Keyset Name,ID,Conc into one e.g. Actual Dataframe

ID Name Conc Val1 Val2
1  XYZ       10    0
1  XYZ       0     20
2  ABC       10    0
2  ABC       0     15

Converted Dataframe

ID Name Conc Val1 Val2
1  XYZ       10    20
2  ABC       10    15
Saumya Pandey
  • 317
  • 1
  • 10
  • Seems obvious, what's the problem? – cs95 Jun 22 '18 at 06:09
  • @coldspeed I know that i need to use group by but because of the empty conc column I am unable to do so.. df.groupby(['ID','Name'],as_index=False).max() This is not able to accomplish the task – Saumya Pandey Jun 22 '18 at 07:01
  • Can you try `df.groupby['ID','Name']).agg({'Val1' : 'sum', 'Val2' : 'sum'})`? – irene Jun 22 '18 at 08:25

0 Answers0