File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -867,7 +867,7 @@ def _ob_index_and_ids(
867
867
names = names ,
868
868
verify_integrity = False ,
869
869
)
870
- if not consistent_sorting :
870
+ if not consistent_sorting and len ( ob_index ) > 0 :
871
871
# Sort by the levels where the corresponding sort argument is True
872
872
n_levels = len (sorts )
873
873
drop_levels = [
@@ -881,9 +881,7 @@ def _ob_index_and_ids(
881
881
sorter = ob_index .argsort ()
882
882
ob_index = ob_index .take (sorter )
883
883
_ , index = np .unique (sorter , return_index = True )
884
- na_ids = ob_ids == - 1
885
- if not na_ids .all ():
886
- ob_ids = np .where (na_ids , - 1 , index .take (ob_ids ))
884
+ ob_ids = np .where (ob_ids == - 1 , - 1 , index .take (ob_ids ))
887
885
ob_ids = ensure_platform_int (ob_ids )
888
886
return ob_index , ob_ids
889
887
You can’t perform that action at this time.
0 commit comments