12
12
from pandas .util ._decorators import Appender , cache_readonly , doc
13
13
14
14
from pandas .core .dtypes .common import (
15
- ensure_platform_int ,
16
15
is_bool_dtype ,
17
16
is_datetime64_any_dtype ,
18
17
is_dtype_equal ,
@@ -473,12 +472,13 @@ def get_indexer(self, target, method=None, limit=None, tolerance=None):
473
472
target = ensure_index (target )
474
473
475
474
if isinstance (target , PeriodIndex ):
476
- if target .freq != self .freq :
475
+ if not self ._is_comparable_dtype (target .dtype ):
476
+ # i.e. target.freq != self.freq
477
477
# No matches
478
478
no_matches = - 1 * np .ones (self .shape , dtype = np .intp )
479
479
return no_matches
480
480
481
- target = target .asi8
481
+ target = target ._get_engine_target () # i.e. target. asi8
482
482
self_index = self ._int64index
483
483
else :
484
484
self_index = self
@@ -491,19 +491,6 @@ def get_indexer(self, target, method=None, limit=None, tolerance=None):
491
491
492
492
return Index .get_indexer (self_index , target , method , limit , tolerance )
493
493
494
- @Appender (_index_shared_docs ["get_indexer_non_unique" ] % _index_doc_kwargs )
495
- def get_indexer_non_unique (self , target ):
496
- target = ensure_index (target )
497
-
498
- if not self ._is_comparable_dtype (target .dtype ):
499
- no_matches = - 1 * np .ones (self .shape , dtype = np .intp )
500
- return no_matches , no_matches
501
-
502
- target = target .asi8
503
-
504
- indexer , missing = self ._int64index .get_indexer_non_unique (target )
505
- return ensure_platform_int (indexer ), missing
506
-
507
494
def get_loc (self , key , method = None , tolerance = None ):
508
495
"""
509
496
Get integer location for requested label.
0 commit comments