Skip to content

Commit df1d155

Browse files
committed
TYP: Fix annotation of Grouper._set_grouper
The return value is never used. Don't pretend that it is. Ideally we don't even hold this state inside the Grouper, it would make it easier to reason about. But just do this tiny change for now, still an improvement. See #46258 for more details.
1 parent 0281563 commit df1d155

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pandas/core/groupby/grouper.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def _get_grouper(
339339
return self.binner, self.grouper, self.obj # type: ignore[return-value]
340340

341341
@final
342-
def _set_grouper(self, obj: NDFrame, sort: bool = False):
342+
def _set_grouper(self, obj: NDFrame, sort: bool = False) -> None:
343343
"""
344344
given an object and the specifications, setup the internal grouper
345345
for this particular specification
@@ -413,7 +413,6 @@ def _set_grouper(self, obj: NDFrame, sort: bool = False):
413413
# "NDFrameT", variable has type "None")
414414
self.obj = obj # type: ignore[assignment]
415415
self._gpr_index = ax
416-
return self._gpr_index
417416

418417
@final
419418
@property

0 commit comments

Comments
 (0)