Binning within subgroup

I have a df with Market, Retailer and Sales, and I need to bin Sales in quantiles by Retailer within each of their respective Markets.

df
Market Retailer Sales_bin
1 Atlanta 1 3
2 Atlanta 2 2
3 Atlanta 3 1
4 Boston 4 3
5 Boston 5 2
6 Boston 6 1

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.