Skip to content

BUG: Not properly checking if post_processing function is callable or not in _get_cythonized_result() function in class GroupBy #33955

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

Closed
3 tasks done
KenilMehta opened this issue May 3, 2020 · 6 comments
Labels
API - Consistency Internal Consistency of API/Behavior Groupby
Milestone

Comments

@KenilMehta
Copy link
Contributor

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.

Problem description

While looking at the code, I found this line which I think is a bug. In the current master branch, pandas/core/groupby/groupby.py file, in the _get_cythonized_result() function :

        if post_processing:
            if not callable(pre_processing):
                raise ValueError("'post_processing' must be a callable!")

While checking if post_processing is callable or not, we are actually passing pre_processing object instead of post_processing. This looks like a bug.

Expected Code

        if post_processing:
            if not callable(post_processing):
                raise ValueError("'post_processing' must be a callable!")
@KenilMehta KenilMehta added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 3, 2020
@jreback
Copy link
Contributor

jreback commented May 3, 2020

user codes don’t hit this
so is there any user facing issue?

@KenilMehta
Copy link
Contributor Author

No, not that I know of.
But I think we should still fix it.

@jreback
Copy link
Contributor

jreback commented May 3, 2020

not averse to an AssertionError

KenilMehta added a commit to KenilMehta/pandas that referenced this issue May 3, 2020
@WillAyd
Copy link
Member

WillAyd commented May 5, 2020

Looks like a typo. PR welcome

@jreback jreback added this to the 1.1 milestone Jun 15, 2020
@jreback jreback added Groupby API - Consistency Internal Consistency of API/Behavior and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 15, 2020
@TomAugspurger
Copy link
Contributor

@rhshadrach was this closed by #34372?

@rhshadrach
Copy link
Member

@TomAugspurger - Yes, thanks for catching this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Groupby
Projects
None yet
5 participants