diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index a0d33cb513722..f51f31af4799a 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -843,6 +843,7 @@ Other Deprecations - Deprecated setting a categorical's categories with ``cat.categories = ['a', 'b', 'c']``, use :meth:`Categorical.rename_categories` instead (:issue:`37643`) - Deprecated unused arguments ``encoding`` and ``verbose`` in :meth:`Series.to_excel` and :meth:`DataFrame.to_excel` (:issue:`47912`) - Deprecated producing a single element when iterating over a :class:`DataFrameGroupBy` or a :class:`SeriesGroupBy` that has been grouped by a list of length 1; A tuple of length one will be returned instead (:issue:`42795`) +- Fixed up warning message of deprecation of :meth:`MultiIndex.lesort_depth` as public method, as the message previously referred to :meth:`MultiIndex.is_lexsorted` instead (:issue:`38701`) .. --------------------------------------------------------------------------- .. _whatsnew_150.performance: diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 5a9b1e6943608..493d03ed1a86c 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1910,7 +1910,7 @@ def _is_lexsorted(self) -> bool: @property def lexsort_depth(self) -> int: warnings.warn( - "MultiIndex.is_lexsorted is deprecated as a public function, " + "MultiIndex.lexsort_depth is deprecated as a public function, " "users should use MultiIndex.is_monotonic_increasing instead.", FutureWarning, stacklevel=find_stack_level(), diff --git a/pandas/tests/indexes/multi/test_lexsort.py b/pandas/tests/indexes/multi/test_lexsort.py index c37172ad7a980..0aadbdb5c32da 100644 --- a/pandas/tests/indexes/multi/test_lexsort.py +++ b/pandas/tests/indexes/multi/test_lexsort.py @@ -24,7 +24,10 @@ def test_is_lexsorted(self): def test_is_lexsorted_deprecation(self): # GH 32259 - with tm.assert_produces_warning(): + with tm.assert_produces_warning( + FutureWarning, + match="MultiIndex.is_lexsorted is deprecated as a public function", + ): MultiIndex.from_arrays([["a", "b", "c"], ["d", "f", "e"]]).is_lexsorted() @@ -53,5 +56,8 @@ def test_lexsort_depth(self): def test_lexsort_depth_deprecation(self): # GH 32259 - with tm.assert_produces_warning(): + with tm.assert_produces_warning( + FutureWarning, + match="MultiIndex.lexsort_depth is deprecated as a public function", + ): MultiIndex.from_arrays([["a", "b", "c"], ["d", "f", "e"]]).lexsort_depth