Skip to content

Commit

Permalink
Guard against IntegerArray + cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Feb 3, 2019
1 parent c8bc02c commit 8248536
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Performance Improvements

- Significant speedup in `SparseArray` initialization that benefits most operations, fixing performance regression introduced in v0.20.0 (:issue:`24985`)
- `DataFrame.to_stata()` is now faster when outputting data with any string or non-native endian columns (:issue:`25045`)
- Improved performance of :meth:`Series.searchsorted`. The speedup is especially large when the dtype is int8/int16/int32 and the searched key is within
the integer bounds for the dtype(:issue:`22034`)
- Improved performance of :meth:`Series.searchsorted`. The speedup is especially large when the dtype is
int8/int16/int32 and the searched key is within the integer bounds for the dtype(:issue:`22034`)


.. _whatsnew_0250.bug_fixes:
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,9 @@ def func(arr, indexer, out, fill_value=np.nan):
return out


# ---- #
# ------------ #
# searchsorted #
# ---- #
# ------------ #

def searchsorted(arr, value, side="left", sorter=None):
"""
Expand Down Expand Up @@ -1774,7 +1774,7 @@ def searchsorted(arr, value, side="left", sorter=None):
if sorter is not None:
sorter = ensure_platform_int(sorter)

if is_integer_dtype(arr) and (
if isinstance(arr, np.ndarray) and is_integer_dtype(arr) and (
is_integer(value) or is_integer_dtype(value)):
from .arrays.array_ import array
# if `arr` and `value` have different dtypes, `arr` would be
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import numpy as np

from pandas._libs import lib, tslibs
import pandas.compat as compat
from pandas.compat import PY36, OrderedDict, iteritems

from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
Expand All @@ -21,8 +22,6 @@
from pandas.core.dtypes.inference import _iterable_not_string
from pandas.core.dtypes.missing import isna, isnull, notnull # noqa

from pandas import compat


class SettingWithCopyError(ValueError):
pass
Expand Down

0 comments on commit 8248536

Please sign in to comment.