-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
IndexRelated to the Index class or subclassesRelated to the Index class or subclassesIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version
Milestone
Description
This fails with main but works with released pandas:
>>> idx = pd.RangeIndex(1)
>>> idx[pd.Series([True])]
RangeIndex(start=0, stop=1, step=1)
>>> idx[pd.Series([True]).array]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[80], line 1
----> 1 idx[pd.Series([True]).array]
File ~/scipy/repos/pandas/pandas/core/indexes/range.py:1309, in RangeIndex.__getitem__(self, key)
1307 key = np.flatnonzero(key)
1308 try:
-> 1309 return self.take(key)
1310 except (TypeError, ValueError):
1311 return super().__getitem__(key)
File ~/scipy/repos/pandas/pandas/core/indexes/range.py:1508, in RangeIndex.take(self, indices, axis, allow_fill, fill_value, **kwargs)
1506 ind_max = indices.max()
1507 if ind_max >= len(self):
-> 1508 raise IndexError(
1509 f"index {ind_max} is out of bounds for axis 0 with size {len(self)}"
1510 )
1511 ind_min = indices.min()
1512 if ind_min < -len(self):
IndexError: index 1 is out of bounds for axis 0 with size 1Metadata
Metadata
Assignees
Labels
IndexRelated to the Index class or subclassesRelated to the Index class or subclassesIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version