diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-01-31 19:59:59 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-01-31 19:59:59 -0700 |
commit | ea9775606c8303a3fd65fdf21a4a02846cef971e (patch) | |
tree | 46aa84bc84684e2e7c373952b3d967a6cad34dd2 /numpy/lib/function_base.py | |
parent | e36d7cab82570b82df3ff0dbc1fc066ae1632768 (diff) | |
parent | 9ec694b69a231a8de43032711c657d253edbed9d (diff) | |
download | numpy-ea9775606c8303a3fd65fdf21a4a02846cef971e.tar.gz |
Merge pull request #7129 from madphysicist/percentile-midpoint-interpolation
BUG: Fixed 'midpoint' interpolation of np.percentile in odd cases.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 1d9030ec6..a49d02a1a 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3543,7 +3543,7 @@ def _percentile(a, q, axis=None, out=None, elif interpolation == 'higher': indices = ceil(indices).astype(intp) elif interpolation == 'midpoint': - indices = floor(indices) + 0.5 + indices = 0.5 * (floor(indices) + ceil(indices)) elif interpolation == 'nearest': indices = around(indices).astype(intp) elif interpolation == 'linear': |