We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10836a2 commit 62bdbdfCopy full SHA for 62bdbdf
pandas/core/groupby/grouper.py
@@ -349,12 +349,11 @@ def _set_grouper(
349
reverse_indexer = self._indexer.argsort()
350
unsorted_ax = self._grouper.take(reverse_indexer)
351
ax = unsorted_ax.take(obj.index)
352
- else:
353
- if not isinstance(obj.index, RangeIndex):
354
- # GH 59350: Index is ignored when using the on keyword argument
355
- # to resample.
356
- obj = obj.reset_index(drop=True)
+ elif isinstance(obj.index, RangeIndex):
357
ax = self._grouper.take(obj.index)
+ else:
+ # GH 59350
+ ax = self._grouper
358
else:
359
if key not in obj._info_axis:
360
raise KeyError(f"The grouper name {key} is not found")
0 commit comments