Skip to content

Commit 0dad72c

Browse files
committed
rebase
1 parent abbacb1 commit 0dad72c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pandas/core/common.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,19 +510,24 @@ def searchsorted_integer(arr, value, side="left", sorter=None):
510510
int or numpy.array
511511
The locations(s) of `value` in `arr`.
512512
"""
513+
from .arrays.array_ import array
513514
if sorter is not None:
514515
sorter = ensure_platform_int(sorter)
515516

516517
# below we try to give `value` the same dtype as `arr`, while guarding
517518
# against integer overflows. If the value of `value` is outside of the
518519
# bound of `arr`, `arr` would be recast by numpy, causing a slower search.
519520
value_arr = np.array([value]) if is_scalar(value) else np.array(value)
520-
iinfo = np.iinfo(arr.dtype)
521+
iinfo = np.iinfo(arr.dtype.type)
521522
if (value_arr >= iinfo.min).all() and (value_arr <= iinfo.max).all():
522523
dtype = arr.dtype
523524
else:
524525
dtype = value_arr.dtype
525-
value = np.asarray(value, dtype=dtype)
526+
527+
if is_scalar(value):
528+
value = dtype.type(value)
529+
else:
530+
value = array(value, dtype=dtype)
526531

527532
return arr.searchsorted(value, side=side, sorter=sorter)
528533

0 commit comments

Comments
 (0)