Skip to content

Commit

Permalink
Move orig_obj arg in constructor to last param, to account for possib…
Browse files Browse the repository at this point in the history
…le empty param
  • Loading branch information
Kei committed Apr 17, 2024
1 parent fb548ad commit baa1b28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,6 @@ def _gotitem(self, key, ndim: int, subset=None):
orig_obj = self.orig_obj if not self.observed else None
return SeriesGroupBy(
subset,
orig_obj,
self.keys,
level=self.level,
grouper=self._grouper,
Expand All @@ -2059,6 +2058,7 @@ def _gotitem(self, key, ndim: int, subset=None):
group_keys=self.group_keys,
observed=self.observed,
dropna=self.dropna,
orig_obj=orig_obj,
)

raise AssertionError("invalid ndim for _gotitem")
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ class GroupBy(BaseGroupBy[NDFrameT]):
def __init__(
self,
obj: NDFrameT,
orig_obj: NDFrameT | None = None,
keys: _KeysArgType | None = None,
level: IndexLabel | None = None,
grouper: ops.BaseGrouper | None = None,
Expand All @@ -1108,6 +1107,7 @@ def __init__(
group_keys: bool = True,
observed: bool = False,
dropna: bool = True,
orig_obj: NDFrameT | None = None,
) -> None:
self._selection = selection

Expand Down

0 comments on commit baa1b28

Please sign in to comment.