Find the percentile of a value
You should use a list comprehension
by dividing each of the list value to the max(lst) -1
lst = [1,2,3,4,5]
max_val = max(lst) -1
lst = [(elem-1)/max_val * 100 for elem in lst]
print(lst)
Output
[0.0, 25.0, 50.0, 75.0, 100.0]
You can also achieve this using numpy
arrays.
arr = np.array([1,2,3,4,5])
result = (arr - 1) / (np.max(arr) - 1) * 100