Open mdusan opened 7 years ago
If the value p = 1 (100%) is chosen, sorted(x)[p_index] is out of bounds because p_index = p * len(x) = 1 * len(x) = len(x) and the list x is indexed from [0] to [len(x)-1].
p = 1 (100%)
sorted(x)[p_index]
p_index = p * len(x) = 1 * len(x) = len(x)
x
[0]
[len(x)-1]
Correction proposed (line 50 of statistics.py):
p_index = int(p * len(x))
p_index = int(p * len(x)) - 1
If the value
p = 1 (100%)
is chosen,sorted(x)[p_index]
is out of bounds becausep_index = p * len(x) = 1 * len(x) = len(x)
and the listx
is indexed from[0]
to[len(x)-1]
.Correction proposed (line 50 of statistics.py):
p_index = int(p * len(x))
top_index = int(p * len(x)) - 1