From b2c1d4b72f4f9011abf356097565691c68f14652 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 10:16:57 -0700 Subject: [PATCH 01/11] requested follow-ups --- pandas/core/internals/blocks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 1e84437f5c2fc..f931df25c4fd5 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -2249,9 +2249,9 @@ def _can_hold_element(self, element): tipo = maybe_infer_dtype_type(element) if tipo is not None: return tipo == _NS_DTYPE or tipo == np.int64 - if isinstance(element, datetime): + elif isinstance(element, datetime): return element.tzinfo is None - if is_integer(element): + elif is_integer(element): return element == tslibs.iNaT # TODO: shouldnt we exclude timedelta64("NaT")? See GH#27297 @@ -2607,7 +2607,7 @@ def _can_hold_element(self, element): tipo = maybe_infer_dtype_type(element) if tipo is not None: return issubclass(tipo.type, (np.timedelta64, np.int64)) - if element is NaT: + elif element is NaT: return True return is_integer(element) or isinstance( element, (timedelta, np.timedelta64, np.int64) From 0ff558c17ed7fb66e8b722a05faa5f6cb8c82f65 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 17:19:31 -0700 Subject: [PATCH 02/11] docstring --- pandas/core/indexers.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexers.py b/pandas/core/indexers.py index 7b0030b91e4dc..70c48e969172f 100644 --- a/pandas/core/indexers.py +++ b/pandas/core/indexers.py @@ -36,9 +36,19 @@ def is_scalar_indexer(indexer, arr_value) -> bool: return False -def is_empty_indexer(indexer, arr_value) -> bool: - # return a boolean if we have an empty indexer +def is_empty_indexer(indexer, arr_value: np.ndarray) -> bool: + """ + Check if we have an empty indexer. + + Parameters + ---------- + indexer : object + arr_value : np.ndarray + Returns + ------- + bool + """ if is_list_like(indexer) and not len(indexer): return True if arr_value.ndim == 1: From 2afbc6eead18fc6f57eda63d53bb1558ecd32aba Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 17:59:41 -0700 Subject: [PATCH 03/11] replace usages of reversed lambdas --- pandas/tests/arithmetic/test_numeric.py | 14 +++++++------- pandas/tests/series/test_operators.py | 2 +- pandas/tests/sparse/series/test_series.py | 13 +++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 1fbecbab469e4..2baee8bbe27a6 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -881,13 +881,13 @@ def check(series, other): _check_op(series, other, operator.pow, pos_only=True) - _check_op(series, other, lambda x, y: operator.add(y, x)) - _check_op(series, other, lambda x, y: operator.sub(y, x)) - _check_op(series, other, lambda x, y: operator.truediv(y, x)) - _check_op(series, other, lambda x, y: operator.floordiv(y, x)) - _check_op(series, other, lambda x, y: operator.mul(y, x)) - _check_op(series, other, lambda x, y: operator.pow(y, x), pos_only=True) - _check_op(series, other, lambda x, y: operator.mod(y, x)) + _check_op(series, other, ops.radd) + _check_op(series, other, ops.rsub) + _check_op(series, other, ops.rtruediv) + _check_op(series, other, ops.rfloordiv) + _check_op(series, other, ops.rmul) + _check_op(series, other, ops.rpow, pos_only=True) + _check_op(series, other, ops.rmod) tser = tm.makeTimeSeries().rename("ts") check(tser, tser * 2) diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index 0c25df7997469..7a0ff6d68f919 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -694,7 +694,7 @@ def test_operators_corner(self): pairings = [ (Series.div, operator.truediv, 1), - (Series.rdiv, lambda x, y: operator.truediv(y, x), 1), + (Series.rdiv, ops.rtruediv, 1), ] for op in ["add", "sub", "mul", "pow", "truediv", "floordiv"]: fv = 0 diff --git a/pandas/tests/sparse/series/test_series.py b/pandas/tests/sparse/series/test_series.py index ad4c898b004ac..899752cde54ed 100644 --- a/pandas/tests/sparse/series/test_series.py +++ b/pandas/tests/sparse/series/test_series.py @@ -12,6 +12,7 @@ import pandas as pd from pandas import DataFrame, Series, SparseDtype, SparseSeries, bdate_range, isna +from pandas.core import ops from pandas.core.reshape.util import cartesian_product import pandas.core.sparse.frame as spf from pandas.tests.series.test_api import SharedWithSparse @@ -572,16 +573,16 @@ def check(a, b): _check_op(a, b, operator.floordiv) _check_op(a, b, operator.mul) - _check_op(a, b, lambda x, y: operator.add(y, x)) - _check_op(a, b, lambda x, y: operator.sub(y, x)) - _check_op(a, b, lambda x, y: operator.truediv(y, x)) - _check_op(a, b, lambda x, y: operator.floordiv(y, x)) - _check_op(a, b, lambda x, y: operator.mul(y, x)) + _check_op(a, b, ops.radd) + _check_op(a, b, ops.rsub) + _check_op(a, b, ops.rtruediv) + _check_op(a, b, ops.rfloordiv) + _check_op(a, b, ops.rmul) # FIXME: don't leave commented-out # NaN ** 0 = 1 in C? # _check_op(a, b, operator.pow) - # _check_op(a, b, lambda x, y: operator.pow(y, x)) + # _check_op(a, b, ops.rpow) check(self.bseries, self.bseries) check(self.iseries, self.iseries) From d93be999c5af9e7b5954151208eebeb64d810b16 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 19:03:02 -0700 Subject: [PATCH 04/11] Remove no longer used construct_axes_dict_for_slice, _AXIS_SLICEMAP --- pandas/core/generic.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 5db06d32880cc..810b411edd727 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -274,7 +274,6 @@ def _setup_axes( info_axis=None, stat_axis=None, aliases=None, - slicers=None, axes_are_reversed=False, build_axes=True, ns=None, @@ -288,7 +287,6 @@ def _setup_axes( info_axis_num : the axis of the selector dimension (int) stat_axis_num : the number of axis for the default stats (int) aliases : other names for a single axis (dict) - slicers : how axes slice to others (dict) axes_are_reversed : boolean whether to treat passed axes as reversed (DataFrame) build_axes : setup the axis properties (default True) @@ -300,7 +298,6 @@ def _setup_axes( cls._AXIS_ALIASES = aliases or dict() cls._AXIS_IALIASES = {v: k for k, v in cls._AXIS_ALIASES.items()} cls._AXIS_NAMES = dict(enumerate(axes)) - cls._AXIS_SLICEMAP = slicers or None cls._AXIS_REVERSED = axes_are_reversed # typ @@ -347,15 +344,6 @@ def _construct_axes_dict_from(self, axes, **kwargs): d.update(kwargs) return d - def _construct_axes_dict_for_slice(self, axes=None, **kwargs): - """Return an axes dictionary for myself.""" - d = { - self._AXIS_SLICEMAP[a]: self._get_axis(a) - for a in (axes or self._AXIS_ORDERS) - } - d.update(kwargs) - return d - def _construct_axes_from_arguments( self, args, kwargs, require_all=False, sentinel=None ): From 5bb0d93e32a9ea29f631cc57de4d9cccf042836a Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 19:05:47 -0700 Subject: [PATCH 05/11] remove no-longer-users expand_axes --- pandas/core/generic.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 810b411edd727..0832e55494ce8 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -565,18 +565,6 @@ def _obj_with_exclusions(self): """ internal compat with SelectionMixin """ return self - def _expand_axes(self, key): - new_axes = [] - for k, ax in zip(key, self.axes): - if k not in ax: - if type(k) != ax.dtype.type: - ax = ax.astype("O") - new_axes.append(ax.insert(len(ax), k)) - else: - new_axes.append(ax) - - return new_axes - def set_axis(self, labels, axis=0, inplace=None): """ Assign desired index to given axis. From b12ff3a890c51cfe8ba5d177623466feded2b516 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 20:24:11 -0700 Subject: [PATCH 06/11] typing pass --- pandas/core/indexing.py | 62 ++++++++++++----------------- pandas/io/pytables.py | 1 + pandas/tests/frame/test_indexing.py | 1 + 3 files changed, 27 insertions(+), 37 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 1f25be8b9e31e..ceececc0393ff 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -157,9 +157,7 @@ def _get_label(self, label, axis=None): return self.obj._xs(label, axis=axis) - def _get_loc(self, key, axis=None): - if axis is None: - axis = self.axis + def _get_loc(self, key, axis: int): return self.obj._ixs(key, axis=axis) def _slice(self, obj, axis=None, kind=None): @@ -188,8 +186,9 @@ def _get_setitem_indexer(self, key): if isinstance(key, range): return self._convert_range(key, is_setter=True) + ax_num = self.axis or 0 try: - return self._convert_to_indexer(key, is_setter=True) + return self._convert_to_indexer(key, axis=ax_num, is_setter=True) except TypeError as e: # invalid indexer type vs 'other' indexing errors @@ -205,7 +204,7 @@ def __setitem__(self, key, value): indexer = self._get_setitem_indexer(key) self._setitem_with_indexer(indexer, value) - def _validate_key(self, key, axis): + def _validate_key(self, key, axis: int): """ Ensure that key is valid for current indexer. @@ -213,7 +212,6 @@ def _validate_key(self, key, axis): ---------- key : scalar, slice or list-like The key requested - axis : int Dimension on which the indexing is being made @@ -221,10 +219,8 @@ def _validate_key(self, key, axis): ------ TypeError If the key (or some element of it) has wrong type - IndexError If the key (or some element of it) is out of bounds - KeyError If the key was not found """ @@ -248,7 +244,7 @@ def _is_nested_tuple_indexer(self, tup): return any(is_nested_tuple(tup, ax) for ax in self.obj.axes) return False - def _convert_tuple(self, key, is_setter=False): + def _convert_tuple(self, key, is_setter: bool = False): keyidx = [] if self.axis is not None: axis = self.obj._get_axis_number(self.axis) @@ -267,19 +263,17 @@ def _convert_tuple(self, key, is_setter=False): keyidx.append(idx) return tuple(keyidx) - def _convert_range(self, key, is_setter=False): + def _convert_range(self, key, is_setter: bool = False): """ convert a range argument """ return list(key) - def _convert_scalar_indexer(self, key, axis): + def _convert_scalar_indexer(self, key, axis: int): # if we are accessing via lowered dim, use the last dim - if axis is None: - axis = 0 ax = self.obj._get_axis(min(axis, self.ndim - 1)) # a scalar return ax._convert_scalar_indexer(key, kind=self.name) - def _convert_slice_indexer(self, key, axis): + def _convert_slice_indexer(self, key, axis: int): # if we are accessing via lowered dim, use the last dim ax = self.obj._get_axis(min(axis, self.ndim - 1)) return ax._convert_slice_indexer(key, kind=self.name) @@ -884,7 +878,7 @@ def _multi_take(self, tup): } return o._reindex_with_indexers(d, copy=True, allow_dups=True) - def _convert_for_reindex(self, key, axis=None): + def _convert_for_reindex(self, key, axis: int): return key def _handle_lowerdim_multi_index_axis0(self, tup): @@ -1056,7 +1050,7 @@ def _getitem_axis(self, key, axis=None): return self._get_label(key, axis=axis) - def _get_listlike_indexer(self, key, axis, raise_missing=False): + def _get_listlike_indexer(self, key, axis: int, raise_missing: bool = False): """ Transform a list-like of keys into a new index and an indexer. @@ -1152,7 +1146,9 @@ def _getitem_iterable(self, key, axis: int): {axis: [keyarr, indexer]}, copy=True, allow_dups=True ) - def _validate_read_indexer(self, key, indexer, axis, raise_missing=False): + def _validate_read_indexer( + self, key, indexer, axis: int, raise_missing: bool = False + ): """ Check that indexer can be used to return a result (e.g. at least one element was found, unless the list of keys was actually empty). @@ -1217,7 +1213,9 @@ def _validate_read_indexer(self, key, indexer, axis, raise_missing=False): if not (ax.is_categorical() or ax.is_interval()): warnings.warn(_missing_key_warning, FutureWarning, stacklevel=6) - def _convert_to_indexer(self, obj, axis=None, is_setter=False, raise_missing=False): + def _convert_to_indexer( + self, obj, axis: int, is_setter: bool = False, raise_missing=False + ): """ Convert indexing key into something we can use to do actual fancy indexing on an ndarray @@ -1232,9 +1230,6 @@ def _convert_to_indexer(self, obj, axis=None, is_setter=False, raise_missing=Fal raise AmbiguousIndexError with integer labels? - No, prefer label-based indexing """ - if axis is None: - axis = self.axis or 0 - labels = self.obj._get_axis(axis) if isinstance(obj, slice): @@ -1363,7 +1358,7 @@ def __init__(self, name, obj): super().__init__(name, obj) @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis): + def _validate_key(self, key, axis: int): if isinstance(key, slice): return True @@ -1379,7 +1374,7 @@ def _validate_key(self, key, axis): return True - def _convert_for_reindex(self, key, axis=None): + def _convert_for_reindex(self, key, axis: int): """ Transform a list of keys into a new array ready to be used as axis of the object we return (e.g. including NaNs). @@ -1395,9 +1390,6 @@ def _convert_for_reindex(self, key, axis=None): ------- list-like of labels """ - - if axis is None: - axis = self.axis or 0 labels = self.obj._get_axis(axis) if com.is_bool_indexer(key): @@ -1727,7 +1719,7 @@ class _LocIndexer(_LocationIndexer): _exception = KeyError @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis): + def _validate_key(self, key, axis: int): # valid for a collection of labels (we check their presence later) # slice of labels (where start-end in labels) @@ -2007,7 +1999,7 @@ class _iLocIndexer(_LocationIndexer): _exception = IndexError _get_slice_axis = _NDFrameIndexer._get_slice_axis - def _validate_key(self, key, axis): + def _validate_key(self, key, axis: int): if com.is_bool_indexer(key): if hasattr(key, "index") and isinstance(key.index, Index): if key.index.inferred_type == "integer": @@ -2133,7 +2125,7 @@ def _getitem_tuple(self, tup): return retval - def _get_list_axis(self, key, axis=None): + def _get_list_axis(self, key, axis: int): """ Return Series values by list or array of integers @@ -2146,8 +2138,6 @@ def _get_list_axis(self, key, axis=None): ------- Series object """ - if axis is None: - axis = self.axis or 0 try: return self.obj._take(key, axis=axis) except IndexError: @@ -2185,10 +2175,8 @@ def _getitem_axis(self, key, axis=None): return self._get_loc(key, axis=axis) - def _convert_to_indexer(self, obj, axis=None, is_setter=False): + def _convert_to_indexer(self, obj, axis: int, is_setter: bool = False): """ much simpler as we only have to deal with our valid types """ - if axis is None: - axis = self.axis or 0 # make need to convert a float key if isinstance(obj, slice): @@ -2210,7 +2198,7 @@ def _convert_to_indexer(self, obj, axis=None, is_setter=False): class _ScalarAccessIndexer(_NDFrameIndexer): """ access scalars quickly """ - def _convert_key(self, key, is_setter=False): + def _convert_key(self, key, is_setter: bool = False): return list(key) def __getitem__(self, key): @@ -2290,7 +2278,7 @@ class _AtIndexer(_ScalarAccessIndexer): _takeable = False - def _convert_key(self, key, is_setter=False): + def _convert_key(self, key, is_setter: bool = False): """ require they keys to be the same type as the index (so we don't fallback) """ @@ -2367,7 +2355,7 @@ class _iAtIndexer(_ScalarAccessIndexer): def _has_valid_setitem_indexer(self, indexer): self._has_valid_positional_setitem_indexer(indexer) - def _convert_key(self, key, is_setter=False): + def _convert_key(self, key, is_setter: bool = False): """ require integer args (and convert to label arguments) """ for a, i in zip(self.obj.axes, key): if not is_integer(i): diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 9206463e18fb3..1db177d792401 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -3974,6 +3974,7 @@ def process_filter(field, filt): for axis_name in obj._AXIS_NAMES.values(): axis_number = obj._get_axis_number(axis_name) axis_values = obj._get_axis(axis_name) + assert axis_number is not None # see if the field is the name of an axis if field == axis_name: diff --git a/pandas/tests/frame/test_indexing.py b/pandas/tests/frame/test_indexing.py index c2d38b2938fca..251a6e7a1f7a9 100644 --- a/pandas/tests/frame/test_indexing.py +++ b/pandas/tests/frame/test_indexing.py @@ -1680,6 +1680,7 @@ def test_setitem_single_column_mixed_datetime(self): df.loc["d", :] = np.nan assert not isna(df.loc["c", :]).all() + # FIXME: don't leave commented-out # as of GH 3216 this will now work! # try to set with a list like item # pytest.raises( From 245df6e49b88c721e6451d0f0c9a3270c64306a6 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 10 Jul 2019 21:07:16 -0700 Subject: [PATCH 07/11] blackify --- pandas/tests/series/test_operators.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index 7a0ff6d68f919..062c07cb6242a 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -692,10 +692,7 @@ def test_operators_corner(self): ) tm.assert_series_equal(added[:-5], expected) - pairings = [ - (Series.div, operator.truediv, 1), - (Series.rdiv, ops.rtruediv, 1), - ] + pairings = [(Series.div, operator.truediv, 1), (Series.rdiv, ops.rtruediv, 1)] for op in ["add", "sub", "mul", "pow", "truediv", "floordiv"]: fv = 0 lop = getattr(Series, op) From 545905b3966583e51dfba15826ecfdfdf3bfa0df Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 11 Jul 2019 07:14:40 -0700 Subject: [PATCH 08/11] make mypy happy --- pandas/core/indexing.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 31d6a0579e1ea..3822363bb81cb 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1212,9 +1212,7 @@ def _validate_read_indexer( if not (ax.is_categorical() or ax.is_interval()): warnings.warn(_missing_key_warning, FutureWarning, stacklevel=6) - def _convert_to_indexer( - self, obj, axis: int, is_setter: bool = False, raise_missing=False - ): + def _convert_to_indexer(self, obj, axis: int, is_setter: bool = False): """ Convert indexing key into something we can use to do actual fancy indexing on an ndarray @@ -1291,7 +1289,7 @@ def _convert_to_indexer( return inds else: # When setting, missing keys are not allowed, even with .loc: - kwargs = {"raise_missing": True if is_setter else raise_missing} + kwargs = {"raise_missing": is_setter} return self._get_listlike_indexer(obj, axis, **kwargs)[1] else: try: From cc7425d4e13dfa48a0f7446789d77c995de0c799 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 11 Jul 2019 07:33:36 -0700 Subject: [PATCH 09/11] match signatures --- pandas/core/indexing.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 3822363bb81cb..dbec4a4acc8eb 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1212,7 +1212,9 @@ def _validate_read_indexer( if not (ax.is_categorical() or ax.is_interval()): warnings.warn(_missing_key_warning, FutureWarning, stacklevel=6) - def _convert_to_indexer(self, obj, axis: int, is_setter: bool = False): + def _convert_to_indexer( + self, obj, axis: int, is_setter: bool = False, raise_missing: bool = False + ): """ Convert indexing key into something we can use to do actual fancy indexing on an ndarray @@ -1289,7 +1291,7 @@ def _convert_to_indexer(self, obj, axis: int, is_setter: bool = False): return inds else: # When setting, missing keys are not allowed, even with .loc: - kwargs = {"raise_missing": is_setter} + kwargs = {"raise_missing": True if is_setter else raise_missing} return self._get_listlike_indexer(obj, axis, **kwargs)[1] else: try: @@ -2172,7 +2174,10 @@ def _getitem_axis(self, key, axis=None): return self._get_loc(key, axis=axis) - def _convert_to_indexer(self, obj, axis: int, is_setter: bool = False): + # raise_missing is included for compat with the parent class signature + def _convert_to_indexer( + self, obj, axis: int, is_setter: bool = False, raise_missing: bool = False + ): """ much simpler as we only have to deal with our valid types """ # make need to convert a float key From ac6d28c82474a8eb4c5253d7bb36ce1c9f18380e Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 11 Jul 2019 07:37:42 -0700 Subject: [PATCH 10/11] rename axis-->ax --- pandas/core/indexing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index dbec4a4acc8eb..e9d724be78a94 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -170,11 +170,11 @@ def _get_setitem_indexer(self, key): if self.axis is not None: return self._convert_tuple(key, is_setter=True) - axis = self.obj._get_axis(0) + ax = self.obj._get_axis(0) - if isinstance(axis, MultiIndex) and self.name != "iloc": + if isinstance(ax, MultiIndex) and self.name != "iloc": try: - return axis.get_loc(key) + return ax.get_loc(key) except Exception: pass @@ -187,9 +187,9 @@ def _get_setitem_indexer(self, key): if isinstance(key, range): return self._convert_range(key, is_setter=True) - ax_num = self.axis or 0 + axis = self.axis or 0 try: - return self._convert_to_indexer(key, axis=ax_num, is_setter=True) + return self._convert_to_indexer(key, axis=axis, is_setter=True) except TypeError as e: # invalid indexer type vs 'other' indexing errors From 0c224a383d50c8f7c225020d289dde32aa54e410 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 11 Jul 2019 08:25:10 -0700 Subject: [PATCH 11/11] mypy fixup --- pandas/core/indexing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index e9d724be78a94..01f338a021cec 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -225,7 +225,7 @@ def _validate_key(self, key, axis: int): KeyError If the key was not found """ - raise AbstractMethodError() + raise AbstractMethodError(self) def _has_valid_tuple(self, key): """ check the key for valid keys across my indexer """