Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas groupby multiple columns

df['COUNTER'] =1       #initially, set that counter to 1.
group_data = df.groupby(['Alphabet','Words'])['COUNTER'].sum() #sum function
print(group_data)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #groupby #multiple #columns
ADD COMMENT
Topic
Name
4+6 =