Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

group by but keep all columns pandas

df.groupby(['name'], as_index=False).agg({'value1': 'sum', 'value2': 'sum', 'otherstuff1': 'first', 'otherstuff2': 'first'})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #group #columns #pandas
ADD COMMENT
Topic
Name
9+4 =