Skip to content

Commit b96bf59

Browse files
committed
rebase
1 parent bd6f248 commit b96bf59

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
@@ -511,19 +511,24 @@ def searchsorted_integer(arr, value, side="left", sorter=None):
511511
int or numpy.array
512512
The locations(s) of `value` in `arr`.
513513
"""
514+
from .arrays.array_ import array
514515
if sorter is not None:
515516
sorter = ensure_platform_int(sorter)
516517

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

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

0 commit comments

Comments
 (0)