0

So i have a pandas data frame with a few numeric columns and an id column thats a string in Python

id  a1  a2 a3 a4 
abc 23 33  33 string
dbc 2  3   3 string
abc 3  4   100 string

i want to add all the numeric columns for the same id string.

 id  a1 a2 a3  a4 
 abc 26 37 133 string
 dbc 2  3   3  string 

Is there an elegant way if doing it in pandas or do i have to make a unique list of objects in the first column and loop through them and add them?

user1775614
  • 439
  • 7
  • 12

0 Answers0