So wählen Sie die drei höchsten Einträge innerhalb einer Kategorie in Pandas aus

df.groupby(level=[0,1]).sum().reset_index().sort_values(['borough', 'total_loans'], ascending=[1,0]).groupby('borough').head(3)
Quaint Quetzal