Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to select the three highest entries within a category in pandas

df.groupby(level=[0,1]).sum().reset_index().sort_values(['borough', 'total_loans'], ascending=[1,0]).groupby('borough').head(3)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #highest #entries #category #pandas
ADD COMMENT
Topic
Name
9+3 =