DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
Sum values of column based on the unique values of another column
df.groupby('Column1')['Column2'].sum() Column1 Column2 1 44 2 65 3 30 4 18
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#Sum
#values
#column
#based
#unique
#values
#column
ADD COMMENT
Topic
COMMENT
Name
5+3 =
Submit