If you want to get the n largest values for each category in a pandas DataFrame, use the combination of groupby and nlargest.
groupby
nlargest
My previous tips on pandas.