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/tests/test_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/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 878d00bdf..c3483b032 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2066,7 +2066,7 @@ def compare_results(res, desired): assert_array_equal(res[i], desired[i]) -class TestScoreatpercentile(TestCase): +class TestPercentile(TestCase): def test_basic(self): x = np.arange(8) * 0.5 @@ -2115,6 +2115,10 @@ class TestScoreatpercentile(TestCase): def test_midpoint(self): assert_equal(np.percentile(range(10), 51, interpolation='midpoint'), 4.5) + assert_equal(np.percentile(range(11), 51, + interpolation='midpoint'), 5.5) + assert_equal(np.percentile(range(11), 50, + interpolation='midpoint'), 5) def test_nearest(self): assert_equal(np.percentile(range(10), 51, |