Skip to content

Commit 003b87f

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 257ad4e commit 003b87f

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
@@ -7407,7 +7407,7 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):
74077407

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

0 commit comments

Comments
 (0)