Skip to content

Commit 353fb02

Browse files
committed
added explanation
1 parent 96b79cc commit 353fb02

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
@@ -2078,6 +2078,9 @@ def searchsorted(self, value, side='left', sorter=None):
20782078
if sorter is not None:
20792079
sorter = ensure_platform_int(sorter)
20802080
if not is_extension_type(self._values):
2081+
# numpy searchsorted is only fast if value is of same dtype as the
2082+
# searched array. Below we ensure that value has the right dtype,
2083+
# and is not 0-dimensional.
20812084
value = np.asarray(value, dtype=self._values.dtype)
20822085
value = value[..., np.newaxis] if value.ndim == 0 else value
20832086

0 commit comments

Comments
 (0)