Skip to content

REGR: Allow positional arguments in DataFrame.agg #36950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 9, 2020

Conversation

pganssle
Copy link
Contributor

@pganssle pganssle commented Oct 7, 2020

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.

@simonjayhawkins simonjayhawkins added this to the 1.1.4 milestone Oct 7, 2020
vorhersager pushed a commit to google/madi that referenced this pull request Oct 7, 2020
…andas#36948 and PR: pandas-dev/pandas#36950.

Also makes the set_axis call before plotting the gradient series deliberately in place.

PiperOrigin-RevId: 335933611
vorhersager pushed a commit to google/madi that referenced this pull request Oct 7, 2020
…andas#36948 and PR: pandas-dev/pandas#36950.

Also makes the set_axis call before plotting the gradient series deliberately in place.

PiperOrigin-RevId: 335933611
@jreback jreback added Apply Apply, Aggregate, Transform, Map Regression Functionality that used to work in a prior pandas version labels Oct 8, 2020
@jreback
Copy link
Contributor

jreback commented Oct 8, 2020

seems reasonable; the ci / checks are failing.

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 pandas-devGH-36948.
@pganssle
Copy link
Contributor Author

pganssle commented Oct 8, 2020

The failures look unrelated. I've rebased against the current master and I think #36978 might have been the cause of the check failure.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm merge on green.

@rhshadrach
Copy link
Member

@pganssle Conflict needs resolved.

@simonjayhawkins simonjayhawkins merged commit c135afe into pandas-dev:master Oct 9, 2020
@simonjayhawkins
Copy link
Member

Thanks @pganssle

@simonjayhawkins
Copy link
Member

@meeseeksdev backport 1.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REGR: Dataframe.agg no longer accepts positional arguments as of v1.1.0
4 participants