Skip to content

Commit 60742c3

Browse files
committed
added explanation
1 parent 6ad3f12 commit 60742c3

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
@@ -2395,6 +2395,9 @@ def searchsorted(self, value, side='left', sorter=None):
23952395
if sorter is not None:
23962396
sorter = ensure_platform_int(sorter)
23972397
if not is_extension_type(self._values):
2398+
# numpy searchsorted is only fast if value is of same dtype as the
2399+
# searched array. Below we ensure that value has the right dtype,
2400+
# and is not 0-dimensional.
23982401
value = np.asarray(value, dtype=self._values.dtype)
23992402
value = value[..., np.newaxis] if value.ndim == 0 else value
24002403

0 commit comments

Comments
 (0)