From 93c3d23c3244841a4cda77b3f63acaf0ac2ff3e1 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 5 Jul 2019 22:10:29 -0400 Subject: [PATCH 1/2] COMPAT: catch InvalidIndexError in base Indexer getitem --- pandas/core/indexing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 0bcaa83c49628..7d5c773217494 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -24,7 +24,7 @@ from pandas.core.dtypes.missing import _infer_fill_value, isna import pandas.core.common as com -from pandas.core.index import Index, MultiIndex +from pandas.core.index import Index, MultiIndex, InvalidIndexError # the supported indexers @@ -118,7 +118,7 @@ def __getitem__(self, key): key = tuple(com.apply_if_callable(x, self.obj) for x in key) try: values = self.obj._get_value(*key) - except (KeyError, TypeError): + except (KeyError, TypeError, InvalidIndexError): # TypeError occurs here if the key has non-hashable entries, # generally slice or list. # TODO(ix): most/all of the TypeError cases here are for ix, From e4a12446b9d4029b84460aac97cc15b9d8841fc2 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sat, 6 Jul 2019 16:21:37 -0400 Subject: [PATCH 2/2] isort --- 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 7d5c773217494..c30885291ffc9 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -24,7 +24,7 @@ from pandas.core.dtypes.missing import _infer_fill_value, isna import pandas.core.common as com -from pandas.core.index import Index, MultiIndex, InvalidIndexError +from pandas.core.index import Index, InvalidIndexError, MultiIndex # the supported indexers