Skip to content

Commit 08fd9c0

Browse files
authored
DEPR fixup warning message of MultiIndex.lexsort_depth deprecation (#48025)
fixup warning message of MultiIndex.lexsort_depth deprecation
1 parent 1ab02e4 commit 08fd9c0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

doc/source/whatsnew/v1.5.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ Other Deprecations
843843
- Deprecated setting a categorical's categories with ``cat.categories = ['a', 'b', 'c']``, use :meth:`Categorical.rename_categories` instead (:issue:`37643`)
844844
- Deprecated unused arguments ``encoding`` and ``verbose`` in :meth:`Series.to_excel` and :meth:`DataFrame.to_excel` (:issue:`47912`)
845845
- 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`)
846+
- 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`)
846847

847848
.. ---------------------------------------------------------------------------
848849
.. _whatsnew_150.performance:

pandas/core/indexes/multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ def _is_lexsorted(self) -> bool:
19111911
@property
19121912
def lexsort_depth(self) -> int:
19131913
warnings.warn(
1914-
"MultiIndex.is_lexsorted is deprecated as a public function, "
1914+
"MultiIndex.lexsort_depth is deprecated as a public function, "
19151915
"users should use MultiIndex.is_monotonic_increasing instead.",
19161916
FutureWarning,
19171917
stacklevel=find_stack_level(inspect.currentframe()),

pandas/tests/indexes/multi/test_lexsort.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def test_is_lexsorted(self):
2424

2525
def test_is_lexsorted_deprecation(self):
2626
# GH 32259
27-
with tm.assert_produces_warning():
27+
with tm.assert_produces_warning(
28+
FutureWarning,
29+
match="MultiIndex.is_lexsorted is deprecated as a public function",
30+
):
2831
MultiIndex.from_arrays([["a", "b", "c"], ["d", "f", "e"]]).is_lexsorted()
2932

3033

@@ -53,5 +56,8 @@ def test_lexsort_depth(self):
5356

5457
def test_lexsort_depth_deprecation(self):
5558
# GH 32259
56-
with tm.assert_produces_warning():
59+
with tm.assert_produces_warning(
60+
FutureWarning,
61+
match="MultiIndex.lexsort_depth is deprecated as a public function",
62+
):
5763
MultiIndex.from_arrays([["a", "b", "c"], ["d", "f", "e"]]).lexsort_depth

0 commit comments

Comments
 (0)