diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-11-05 12:24:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 12:24:50 -0500 |
commit | 46ef519a9aef67015166d2fa272b673dc0939532 (patch) | |
tree | 4462dc4de1c27e96f71704b64ac1067f9ea0c8b6 /numpy/lib/function_base.py | |
parent | a3e8a7578f09838b26b12ccd7796ec46a03816f8 (diff) | |
parent | f9c2573898899ee3809dfd4ebba113f6de2d528b (diff) | |
download | numpy-46ef519a9aef67015166d2fa272b673dc0939532.tar.gz |
Merge pull request #18203 from anntzer/fq
MAINT: Speedup np.quantile.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 07d8a4269..4d57acdb2 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4567,7 +4567,8 @@ def _quantile( # The dimensions of `q` are prepended to the output shape, so we need the # axis being sampled from `arr` to be last. DATA_AXIS = 0 - arr = np.moveaxis(arr, axis, destination=DATA_AXIS) + if axis != DATA_AXIS: # But moveaxis is slow, so only call it if axis!=0. + arr = np.moveaxis(arr, axis, destination=DATA_AXIS) # --- Computation of indexes # Index where to find the value in the sorted array. # Virtual because it is a floating point value, not an valid index. |