Skip to content

Commit 359ecb9

Browse files
committed
REGR: Allow positional arguments in DataFrame.agg
Although `DataFrame.agg` is documented as accepting `func, axis, *args, **kwargs` with `*args` and `**kwargs` passed to `func`, passing positional arguments raises a TypeError. The reason for this is that the internal call to `self._aggregate` uses a keyword argument (axis) before passing *args and `**kwargs`, and as such the first positional argument is always interpreted as a second specification of `axis`, which raises TypeError. Prior to commit 433c900, TypeErrors were being suppressed, falling back to `self.apply`, which in v1.1.0 turned into an error. This fixes issue GH-36948.
1 parent 91e8bad commit 359ecb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7406,7 +7406,7 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):
74067406

74077407
result = None
74087408
try:
7409-
result, how = self._aggregate(func, axis=axis, *args, **kwargs)
7409+
result, how = self._aggregate(func, axis, *args, **kwargs)
74107410
except TypeError as err:
74117411
exc = TypeError(
74127412
"DataFrame constructor called with "

0 commit comments

Comments
 (0)