diff options
| author | Matti Picus <matti.picus@gmail.com> | 2022-10-20 22:12:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-20 22:12:41 +0300 |
| commit | df92d35d711c1f9201132285bde36cd2ca468d42 (patch) | |
| tree | 688242aabbb613013e6e7e1c6656a36dfa945964 /numpy | |
| parent | 48b204b641e899ee649eb57ad0652312c083067e (diff) | |
| parent | 7a3a0d790c6208210936d03103f25606bb464c32 (diff) | |
| download | numpy-df92d35d711c1f9201132285bde36cd2ca468d42.tar.gz | |
Merge pull request #22456 from rossbar/deprecate-msort
DEP: Proposal to deprecate the `msort` convenience function
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/lib/function_base.py | 10 | ||||
| -rw-r--r-- | numpy/lib/tests/test_function_base.py | 11 |
2 files changed, 16 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index a0c94114a..6065dd0d3 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3648,6 +3648,10 @@ def msort(a): """ Return a copy of an array sorted along the first axis. + .. deprecated:: 1.24 + + msort is deprecated, use ``np.sort(a, axis=0)`` instead. + Parameters ---------- a : array_like @@ -3674,6 +3678,12 @@ def msort(a): [3, 4]]) """ + # 2022-10-20 1.24 + warnings.warn( + "msort is deprecated, use np.sort(a, axis=0) instead", + DeprecationWarning, + stacklevel=3, + ) b = array(a, subok=True, copy=True) b.sort(0) return b diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 277843222..e407fc78c 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2427,11 +2427,12 @@ class TestMsort: A = np.array([[0.44567325, 0.79115165, 0.54900530], [0.36844147, 0.37325583, 0.96098397], [0.64864341, 0.52929049, 0.39172155]]) - assert_almost_equal( - msort(A), - np.array([[0.36844147, 0.37325583, 0.39172155], - [0.44567325, 0.52929049, 0.54900530], - [0.64864341, 0.79115165, 0.96098397]])) + with pytest.warns(DeprecationWarning, match="msort is deprecated"): + assert_almost_equal( + msort(A), + np.array([[0.36844147, 0.37325583, 0.39172155], + [0.44567325, 0.52929049, 0.54900530], + [0.64864341, 0.79115165, 0.96098397]])) class TestMeshgrid: |
