The intuition behind index calculation could be improved in Percentile2
Closed this issue · 0 comments
zakir8251 commented
Line 2907 in e43e7c1
def Percentile2(scores, percentile_rank):
scores.sort()
index = percentile_rank * (len(scores)-1) // 100
return scores[index]
Instead of
index = percentile_rank * (len(scores)-1) // 100
A more intuitive formula is:-
index = (percentile_rank * (len(scores)) // 100) -1
or even better:-
index = percentile_rank * (len(scores)) // 100
return[index-1] #since indexes start with 0