Skip to content

Commit 89bc856

Browse files
committed
FIX: Test need sort only work on lexsorted indexes
1 parent d6080c0 commit 89bc856

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/indexes/multi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3081,7 +3081,8 @@ def _reorder_indexer(
30813081
# True if the given codes are not ordered
30823082
need_sort = (k_codes[:-1] > k_codes[1:]).any()
30833083
# Bail out if no need to sort
3084-
if not need_sort:
3084+
# This is only true for a lexsorted index
3085+
if not need_sort and self.is_lexsorted():
30853086
return indexer
30863087

30873088
n = len(self)

0 commit comments

Comments
 (0)