Skip to content

Commit 700e4b4

Browse files
committed
added explanation
1 parent 897fe27 commit 700e4b4

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
@@ -2090,6 +2090,9 @@ def searchsorted(self, value, side='left', sorter=None):
20902090
if sorter is not None:
20912091
sorter = ensure_platform_int(sorter)
20922092
if not is_extension_type(self._values):
2093+
# numpy searchsorted is only fast if value is of same dtype as the
2094+
# searched array. Below we ensure that value has the right dtype,
2095+
# and is not 0-dimensional.
20932096
value = np.asarray(value, dtype=self._values.dtype)
20942097
value = value[..., np.newaxis] if value.ndim == 0 else value
20952098

0 commit comments

Comments
 (0)