-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: SeriesGroupBy apply wrong name #46623
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
BUG: SeriesGroupBy apply wrong name #46623
Conversation
da9d644 to
afaa1c4
Compare
rhshadrach
left a comment
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 for the PR; looks really good. One question.
pandas/tests/groupby/test_apply.py
Outdated
| tm.assert_frame_equal(result, expected) | ||
|
|
||
|
|
||
| def test_result_name_when_one_group(): |
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 you parameterize this tests instead of looping
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.
done
pandas/tests/groupby/test_apply.py
Outdated
| result = ser.groupby(["a", "a"]).apply(lambda x: x).name | ||
| expected = name | ||
|
|
||
| assert result == expected |
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 you tm.assert_series_equal and fully construct the expected series
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.
done
afaa1c4 to
370d109
Compare
rhshadrach
left a comment
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.
lgtm
370d109 to
7d2198d
Compare
|
@ma3da - can you merge main. |
…by_apply_wrong_name
|
Failure is unrelated. Will need an approval from @jreback to move forward |
pandas/core/groupby/generic.py
Outdated
| not_indexed_same=not_indexed_same, | ||
| override_group_keys=override_group_keys, | ||
| ) | ||
| result.name = self.obj.name # GH #46369 |
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.
the issue comment is not necessary
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.
Done.
|
looks good can merge on green |
|
Thanks @ma3da! |
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.