Skip to content

Commit 62bdbdf

Browse files
simplify
1 parent 10836a2 commit 62bdbdf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/core/groupby/grouper.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,11 @@ def _set_grouper(
349349
reverse_indexer = self._indexer.argsort()
350350
unsorted_ax = self._grouper.take(reverse_indexer)
351351
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)
352+
elif isinstance(obj.index, RangeIndex):
357353
ax = self._grouper.take(obj.index)
354+
else:
355+
# GH 59350
356+
ax = self._grouper
358357
else:
359358
if key not in obj._info_axis:
360359
raise KeyError(f"The grouper name {key} is not found")

0 commit comments

Comments
 (0)