Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip sortorder
  • Loading branch information
MarcoGorelli committed Jan 1, 2021
commit 39d163fbf511f53ab7af6af502893140efa28c5f
3 changes: 0 additions & 3 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1872,9 +1872,6 @@ def _lexsort_depth(self) -> int:
-------
int
"""
if self.sortorder is not None:
return self.sortorder

int64_codes = [ensure_int64(level_codes) for level_codes in self.codes]
for k in range(self.nlevels, 0, -1):
if libalgos.is_lexsorted(int64_codes[:k]):
Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/indexes/multi/test_lexsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_is_lexsorted(self):
levels=levels, codes=[[0, 0, 1, 0, 1, 1], [0, 1, 0, 2, 2, 1]]
)
assert not index._is_lexsorted()
assert index.lexsort_depth == 0
assert index._lexsort_depth == 0

def test_is_lexsorted_deprecation(self):
# GH 32259
Expand All @@ -39,17 +39,17 @@ def test_lexsort_depth(self):
index = MultiIndex(
levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]], sortorder=2
)
assert index.lexsort_depth == 2
assert index._lexsort_depth == 2

index = MultiIndex(
levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 2, 1]], sortorder=1
)
assert index.lexsort_depth == 1
assert index._lexsort_depth == 1

index = MultiIndex(
levels=levels, codes=[[0, 0, 1, 0, 1, 1], [0, 1, 0, 2, 2, 1]], sortorder=0
)
assert index.lexsort_depth == 0
assert index._lexsort_depth == 0

def test_lexsort_depth_deprecation(self):
# GH 32259
Expand Down