Reputation: 65540
I have the following simple dataframe:
> df = pd.DataFrame({'calc_value': [0, 0.081928, 0.94444]})
> df
calc_value
0 0.000000
1 0.081928
2 0.944440
Why does df.quantile
calculate the 90th percentile as 0.7719376
?
> df.quantile(0.9)['calc_value']`
0.7719376
According to my calculations it should be 0.69
, via (0.944444-0.081928)*((90-50)/(100-50))
.
Upvotes: 1
Views: 1784
Reputation: 20080
Well, step per 0.1 in the range from 0.5...1.0 is equal to (0.94444-0.081928)/5 and is equal to 0.1725024
So 50q is 0.081928
60q is 0.081928+0.1725024=0.25443
70q is 0.081928+2*0.1725024=0.426933
80q is 0.081928+3*0.1725024=0.599435
90q is 0.081928+4*0.1725024=0.771938
100q is 0.081928+5*0.1725024=0.94444
Upvotes: 2