-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
Description
scipy.stats.percentileofscore seems to implicitly assume that input array "a" is a one dimensional vector. When it encounters a multidimensional matrix input, it seemingly calculates the percentile of each dimension, and SUMS them, resulting in a percentile that is potentially greater than 100?
This behaviors surprised me. I would have expected either 1) broadcasting (get back an array of percentiles), 2) reduction (get back the percentile as if the array were one dimensional), or 3) an error. My vote would be for (1), but any would be preferable to summing the percentiles.
Reproducing code example:
import numpy as np
from scipy import stats
foo = np.array([[1,2,3,4],[2,3,4,5]])
bar = stats.percentileofscore(foo, 2)
print(bar) #125
Scipy/Numpy/Python version information:
rcomer