Skip to content

Commit

Permalink
added explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Jul 25, 2018
1 parent 96b79cc commit 353fb02
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,9 @@ def searchsorted(self, value, side='left', sorter=None):
if sorter is not None:
sorter = ensure_platform_int(sorter)
if not is_extension_type(self._values):
# numpy searchsorted is only fast if value is of same dtype as the
# searched array. Below we ensure that value has the right dtype,
# and is not 0-dimensional.
value = np.asarray(value, dtype=self._values.dtype)
value = value[..., np.newaxis] if value.ndim == 0 else value

Expand Down

0 comments on commit 353fb02

Please sign in to comment.