I have below pandas dataframe. I want to create a new column that would give me 75% quantile rate groped by State and County
below code gives me only 75% quantile rate as output, i want to create a new column with 75% quantile rate in the existing df
df = df.groupby('State')['rate'].quantile(0.75)
| State | county | rate |
|---|---|---|
| AK | a | 27.5 |
| AK | a | 30.5 |
| GA | a | 35.5 |
| GA | b | 50.0 |
| GA | b | 75.5 |
| GA | c | 90.5 |
| AR | a | 16.5 |
| AR | a | 10.5 |