print(data.groupby('currency').apply(lambda dfg: dfg.nlargest(select_number
    .loc[dfg.name, 'number_to_select'], 'price')).reset_index(drop=True))
Selecting top n elements from each group in pandas groupby