Skip to content

DEPR fixup warning message of MultiIndex.lexsort_depth deprecation #48025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
10 changes: 8 additions & 2 deletions pandas/tests/indexes/multi/test_lexsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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