I have a pandas dataframe with the following structure:
import pandas as pd df = pd.DataFrame( { "value": [0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0], "group": ["A"] * 6 + ["B"] * 6 } ) I would like to obtain a new dataframe, with the same number of rows, that has, for each row the quantile that corresponds to the value in the group.
For this case, the output would be like this:
There can be a very large number of groups and values on completely different scales, and each group may have different sizes.
