-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix DataFrame.groupby().apply() for NaN groups with dropna=False #35951
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: Fix DataFrame.groupby().apply() for NaN groups with dropna=False #35951
Conversation
…5889) * tests should still fail. * test dropna=True|False with no np.nan in groupings. * fix expected outputs, declare expected MultiIndex in resulting dataframe after df.group().apply()
* nans at same positions in `level` and `key` compares as equal.
* this makes test pass. * follow existing style where we create MultiIndex, then `set_levels` to reinsert nan for case when `dropna=False`, and groups has nan grouping.
* black pandas * git diff upstream/master -u -- "*.py" | flake8 --diff
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 @cwkwong for a nice PR!
Some largely cosmetic comments, otherwise lgtm
@cwkwong might want to have a more descriptive title |
Thanks @arw2019 for approving the changes. What's the next step to hopefully make this as part of the |
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 @cwkwong
This should be moved to whatsnew 1.2.0 note. 1.1.2 mainly focuses on regression issue.
thanks @cwkwong very nice |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
v1.1.2.rst