@@ -442,37 +442,6 @@ def reindex(
442
442
443
443
return new_target , indexer
444
444
445
- # error: Return type "Tuple[Index, Optional[ndarray], Optional[ndarray]]"
446
- # of "_reindex_non_unique" incompatible with return type
447
- # "Tuple[Index, ndarray, Optional[ndarray]]" in supertype "Index"
448
- def _reindex_non_unique ( # type: ignore[override]
449
- self , target : Index
450
- ) -> tuple [Index , np .ndarray | None , np .ndarray | None ]:
451
- """
452
- reindex from a non-unique; which CategoricalIndex's are almost
453
- always
454
- """
455
- # TODO: rule out `indexer is None` here to make the signature
456
- # match the parent class's signature. This should be equivalent
457
- # to ruling out `self.equals(target)`
458
- new_target , indexer = self .reindex (target )
459
- new_indexer = None
460
-
461
- check = indexer == - 1
462
- # error: Item "bool" of "Union[Any, bool]" has no attribute "any"
463
- if check .any (): # type: ignore[union-attr]
464
- new_indexer = np .arange (len (self .take (indexer )), dtype = np .intp )
465
- new_indexer [check ] = - 1
466
-
467
- cats = self .categories .get_indexer (target )
468
- if not (cats == - 1 ).any ():
469
- # .reindex returns normal Index. Revert to CategoricalIndex if
470
- # all targets are included in my categories
471
- cat = Categorical (new_target , dtype = self .dtype )
472
- new_target = type (self )._simple_new (cat , name = self .name )
473
-
474
- return new_target , indexer , new_indexer
475
-
476
445
# --------------------------------------------------------------------
477
446
# Indexing Methods
478
447
0 commit comments