-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix to GH34422 SeriesGroupBy works only with 'func' now #34435
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
Conversation
…are tuple, list or NamedAgg'
Hello @gurukiran07! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-06-03 19:37:24 UTC |
Thanks for the PR Can you add a test as well to show how it would close the linked issue? |
@MarcoGorelli I'm new to open source development. I'm going through writing-tests mentioned in contributing.rst . I'll add tests by tomorrow. It's currently showing failed in 9 checks and 2 successful checks. How and where can I fix those 9 failing checks? |
If you click through on the "Details" you should see the failures. e.g. https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=36338&view=logs&j=bef1c175-2c1b-51ae-044a-2437c76fc339&t=770e7bb1-09f5-5ebf-b63b-578d2906aac9&l=105 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always add tests first
@jreback and @MarcoGorelli Added tests in |
Our documentation has contributing guidelines. Check those at let me know if you still have issues.
… On May 29, 2020, at 05:12, guru kiran ***@***.***> wrote:
@TomAugspurger Thank you. I still have 1 failing check in Linting. How can I fix it? Please excuse me for asking so many doubts. I'm 18 years old with no prior experience in open source development. Thank you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@TomAugspurger Thank you. Now, all checks have been passed. Should have gone through "Coding style" part of contribution guidelines before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gurukiran07 !
def test_agg_namedtuple(self): | ||
# GH34422 | ||
s = pd.Series([1, 1, 2, 2, 3, 3, 4, 5]) | ||
msg = "func is" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can msg
be more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Can be extend msg = "func is expected but recieved NamedAgg"
in this test, while using tuple msg = "func is expected but recieved tuple"
and while using list msg = "func is expected but recieved list"
. Is this fine?
No, strings aren't callable. So it'd need to be a callable or str? Perhaps
we already have something to check that.
…On Mon, Jun 1, 2020 at 3:25 PM guru kiran ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pandas/core/groupby/generic.py
<#34435 (comment)>:
> if relabeling:
columns = list(kwargs)
- func = [kwargs[col] for col in columns]
+ func = []
+ for col in columns:
+ if isinstance(kwargs[col], (list, tuple)):
@TomAugspurger <https://github.com/TomAugspurger> aggfunc can be str
sometimes right.
s.groupby(...).agg(one='sum',two='max)
Will callable return True the above example?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34435 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOITWLMYV7XWCPRMW6NLRUQFDNANCNFSM4NNKSIPQ>
.
|
|
if isinstance(func,str):
return getattr(self,func)(*args,**kwargs) These lines are hit when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. can you add a whatsnew note, groupby section of bug fixes for 1.1. ping on green.
@jreback all 14 checks passed. And updated whatsnew |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments, ping on green.
@jreback All checks passed. Updated with mentioned changes. |
thanks @gurukiran07 very nice! |
@jreback Thank you. It was a huge learning experience, got to learn lot of new stuff. Hope to contribute more in future. |
black pandas
This PR tries to fix the bug pointed in #34422 where
SeriesGroupBy.agg
works with any given column name inNamedAgg
.After discussing with @TomAugspurger and @MarcoGorelli in another issue #34380 regarding this issue in the comments, We came to a solution that
Before fix:
After fix: