19
19
construct_1d_object_array_from_listlike ,
20
20
infer_dtype_from_array ,
21
21
maybe_promote ,
22
- maybe_upcast ,
23
22
)
24
23
from pandas .core .dtypes .common import (
25
24
ensure_float64 ,
@@ -450,13 +449,6 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
450
449
return np .zeros (comps .shape , dtype = bool )
451
450
452
451
comps , dtype = _ensure_data (comps )
453
- if is_numeric_dtype (comps ):
454
- try :
455
- # Try finding a dtype which would not change our values
456
- values , _ = maybe_upcast (values , dtype = dtype )
457
- dtype = values .dtype
458
- except (ValueError , TypeError ):
459
- pass
460
452
values , _ = _ensure_data (values , dtype = dtype )
461
453
462
454
f = htable .ismember_object
@@ -472,7 +464,7 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
472
464
f = lambda c , v : np .logical_or (np .in1d (c , v ), np .isnan (c ))
473
465
else :
474
466
f = np .in1d
475
- elif is_integer_dtype (comps .dtype ) and is_integer_dtype ( values ) :
467
+ elif is_integer_dtype (comps .dtype ):
476
468
try :
477
469
values = values .astype ("int64" , copy = False )
478
470
comps = comps .astype ("int64" , copy = False )
@@ -481,7 +473,7 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
481
473
values = values .astype (object )
482
474
comps = comps .astype (object )
483
475
484
- elif is_numeric_dtype (comps .dtype ) or is_numeric_dtype ( values ):
476
+ elif is_float_dtype (comps .dtype ):
485
477
try :
486
478
values = values .astype ("float64" , copy = False )
487
479
comps = comps .astype ("float64" , copy = False )
0 commit comments