Jul-13-2023, 05:09 PM
After getting an unexpected value from scipy.stats.iqr I discovered the error was coming from np.percentile. Here's an example of my issue:
x=[1,1,1,2,2,2,3,3,3,4]
There are 10 values in x, the 25th percentile should be mean of 2nd and 3rd value, both of which are '1', so the result should = 1,
But np.percentile(x, 25) returns 1.5
I get that Python starts counting at 0, but when using percentile it shouldn't just ignore the first value in the list.
Presumably, this relatively basic and common function of NumPy in 2023, doesn't have an "Error", but I truly feel like it's returning the wrong value. Am I crazy? Can someone explain this issue to me?
x=[1,1,1,2,2,2,3,3,3,4]
There are 10 values in x, the 25th percentile should be mean of 2nd and 3rd value, both of which are '1', so the result should = 1,
But np.percentile(x, 25) returns 1.5
I get that Python starts counting at 0, but when using percentile it shouldn't just ignore the first value in the list.
Presumably, this relatively basic and common function of NumPy in 2023, doesn't have an "Error", but I truly feel like it's returning the wrong value. Am I crazy? Can someone explain this issue to me?