t = df.groupby(['borough', 'title']).sum()
t.sort('total_loans', ascending=True)
t = t.groupby(level=[0, 1]).head(3).reset_index()
t.sort(['borough', 'title'], ascending=(True, False))
pandas: How to find the max n values for each category in a column