@@ -3486,6 +3486,18 @@ def get_indexer(
3486
3486
# Only call equals if we have same dtype to avoid inference/casting
3487
3487
return np .arange (len (target ), dtype = np .intp )
3488
3488
3489
+ if not is_dtype_equal (self .dtype , target .dtype ) and not is_interval_dtype (
3490
+ self .dtype
3491
+ ):
3492
+ # IntervalIndex gets special treatment for partial-indexing
3493
+ dtype = self ._find_common_type_compat (target )
3494
+
3495
+ this = self .astype (dtype , copy = False )
3496
+ target = target .astype (dtype , copy = False )
3497
+ return this ._get_indexer (
3498
+ target , method = method , limit = limit , tolerance = tolerance
3499
+ )
3500
+
3489
3501
return self ._get_indexer (target , method , limit , tolerance )
3490
3502
3491
3503
def _get_indexer (
@@ -3498,15 +3510,6 @@ def _get_indexer(
3498
3510
if tolerance is not None :
3499
3511
tolerance = self ._convert_tolerance (tolerance , target )
3500
3512
3501
- if not is_dtype_equal (self .dtype , target .dtype ):
3502
- dtype = self ._find_common_type_compat (target )
3503
-
3504
- this = self .astype (dtype , copy = False )
3505
- target = target .astype (dtype , copy = False )
3506
- return this .get_indexer (
3507
- target , method = method , limit = limit , tolerance = tolerance
3508
- )
3509
-
3510
3513
if method in ["pad" , "backfill" ]:
3511
3514
indexer = self ._get_fill_indexer (target , method , limit , tolerance )
3512
3515
elif method == "nearest" :
0 commit comments