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 9, 2019
1 parent 093c2be commit 07291ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/source/whatsnew/v0.25.0.rst
Expand Up @@ -60,8 +60,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
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
5 changes: 2 additions & 3 deletions pandas/core/common.py
Expand Up @@ -13,7 +13,8 @@
import numpy as np

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

from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
from pandas.core.dtypes.common import (
Expand All @@ -22,8 +23,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 07291ea

Please sign in to comment.