Skip to content

Commit ba90c9e

Browse files
committed
added explanation
1 parent fc2c789 commit ba90c9e

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
@@ -2335,6 +2335,9 @@ def searchsorted(self, value, side='left', sorter=None):
23352335
if sorter is not None:
23362336
sorter = ensure_platform_int(sorter)
23372337
if not is_extension_type(self._values):
2338+
# numpy searchsorted is only fast if value is of same dtype as the
2339+
# searched array. Below we ensure that value has the right dtype,
2340+
# and is not 0-dimensional.
23382341
value = np.asarray(value, dtype=self._values.dtype)
23392342
value = value[..., np.newaxis] if value.ndim == 0 else value
23402343

0 commit comments

Comments
 (0)