Skip to content

Commit e607c34

Browse files
jorisvandenbosschejreback
authored andcommitted
COMPAT: catch InvalidIndexError in base Indexer getitem (#27259)
1 parent 1d92c77 commit e607c34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/indexing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from pandas.core.dtypes.missing import _infer_fill_value, isna
2525

2626
import pandas.core.common as com
27-
from pandas.core.index import Index, MultiIndex
27+
from pandas.core.index import Index, InvalidIndexError, MultiIndex
2828

2929

3030
# the supported indexers
@@ -118,7 +118,7 @@ def __getitem__(self, key):
118118
key = tuple(com.apply_if_callable(x, self.obj) for x in key)
119119
try:
120120
values = self.obj._get_value(*key)
121-
except (KeyError, TypeError):
121+
except (KeyError, TypeError, InvalidIndexError):
122122
# TypeError occurs here if the key has non-hashable entries,
123123
# generally slice or list.
124124
# TODO(ix): most/all of the TypeError cases here are for ix,

0 commit comments

Comments
 (0)