diff options
author | Joseph Fox-Rabinovitz <joseph.r.fox-rabinovitz@nasa.gov> | 2016-01-27 10:21:46 -0500 |
---|---|---|
committer | Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> | 2016-01-31 20:04:01 -0500 |
commit | 9ec694b69a231a8de43032711c657d253edbed9d (patch) | |
tree | 2b36d09515f869165a17bdb41996ed4b98c0b261 /numpy/lib/function_base.py | |
parent | cc2b0495118e4855acfeaea3253abf449f3e91dd (diff) | |
download | numpy-9ec694b69a231a8de43032711c657d253edbed9d.tar.gz |
BUG: Fixed 'midpoint' interpolation of np.percentile in odd cases.
'midpoint' must return the same as 'higher' and 'lower' when the two
are the same, not 'lower' + 0.5 as it was doing.
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 844c069c0..fbe41442b 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3541,7 +3541,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': |