Closed
Description
xref #27223 (comment)
The change in that PR broke a test in geopandas. We are using some indexing internals in geopandas that were relying on an InvalidIndexError being catched there (and the PR changed it to only TypeError and KeyError.
A small reproducible example without needing geopandas (but it is dummy code, not doing something useful):
from pandas.core.indexing import _NDFrameIndexer
class _CoordinateIndexer(_NDFrameIndexer):
def _getitem_tuple(self, tup):
obj = self.obj
xs, ys = tup
return obj[xs][ys]
pd.Series._create_indexer('cx', _CoordinateIndexer)
s = pd.Series(range(5))
s.cx[:, :]
The below passes on 0.24.2, but gives an error now on master.
The actual code in geopandas is:
I know this is quite internal code of pandas that is being used here, so we should think about making this cleaner, but short term it would be nice to fix this.