I have the DataFrame, where I am trying to add a new "rank" column to determine the price rating relative to the "name" and "country" columns by comparing prices (column 'price'). If one product's price is the same, when using the
df['rank'] = df.groupby('name')['price'].apply(lambda x: x.sort_values().rank())
I get the following result -> column 'rank', but I need to get the one that is highlighted in the 'rank_2' and it is not accurate, because these six products have the same price and should get a rating of 1. How is it possible to get the given result as in the column -> 'rank_2'. Help please, I will be grateful
