Skip to content

Commit 9910278

Browse files
committed
added explanation
1 parent 1e13e98 commit 9910278

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/series.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,6 +2334,9 @@ def searchsorted(self, value, side='left', sorter=None):
23342334
if sorter is not None:
23352335
sorter = ensure_platform_int(sorter)
23362336
if not is_extension_type(self._values):
2337+
# numpy searchsorted is only fast if value is of same dtype as the
2338+
# searched array. Below we ensure that value has the right dtype,
2339+
# and is not 0-dimensional.
23372340
value = np.asarray(value, dtype=self._values.dtype)
23382341
value = value[..., np.newaxis] if value.ndim == 0 else value
23392342

0 commit comments

Comments
 (0)