I have the following dataframe:
df =
code count
A 1
A 2
A 3
A 4
B 7
B 8
B 9
B 10
I want to produce the 25 and 75 quartiles per code:
code 25QT 75QT
A 2.5 3.5
B 8.5 9.5
I have the following dataframe:
df =
code count
A 1
A 2
A 3
A 4
B 7
B 8
B 9
B 10
I want to produce the 25 and 75 quartiles per code:
code 25QT 75QT
A 2.5 3.5
B 8.5 9.5
Copyright © 2021 Jogjafile Inc.
Use
groupby.quantile, thenunstack:Output:
With the format:
Output: