Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas sort values group by

df.groupby(['job']).apply(lambda x: (x.groupby('source')
                                      .sum()
                                      .sort_values('count', ascending=False))
                                     .head(3))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #sort #values #group
ADD COMMENT
Topic
Name
2+8 =