diff options
author | Tobias Pitters <tobias.pitters@gmail.com> | 2020-05-17 15:19:23 +0200 |
---|---|---|
committer | Tobias Pitters <tobias.pitters@gmail.com> | 2020-05-27 19:35:59 +0200 |
commit | 3b0516aded2f0ebc09511db63978c1f1a2445a43 (patch) | |
tree | 9fd97120729d16ddf2045ba5142458688b0c6f5e /numpy/lib/tests/test_function_base.py | |
parent | 27aeb6f71183635e3adcab602118b3d8912e006d (diff) | |
download | numpy-3b0516aded2f0ebc09511db63978c1f1a2445a43.tar.gz |
BUG: np.quantile ordering not monotonic
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 9ba0be56a..c415653e4 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3104,6 +3104,13 @@ class TestQuantile: np.quantile(np.arange(100.), p, interpolation="midpoint") assert_array_equal(p, p0) + def test_quantile_monotic(self): + # GH 14685 + # test that the return value of quantile is monotonic if p0 is ordered + p0 = np.arange(0, 1, 0.01) + quantile = np.quantile(np.array([0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 1, 1, 9, 9, 9, 8, 8, 7]) * 0.1, p0) + equals_sorted = np.sort(quantile) == quantile + assert equals_sorted.all() class TestMedian: |