df['rn'] = df.sort_values(['price'], ascending=False).groupby('currency'
    ).cumcount() + 1
qry = select_number.reset_index().astype(str).apply(lambda x:
    '((currency=="{0[0]}") & (rn<={0[1]}))'.format(x), axis=1).str.cat(sep=
    ' | ')
print(df.query(qry))
Selecting top n elements from each group in pandas groupby