-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fix valueError for groupby with empty inputs when sample method is called #48484
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
ntachukwu
commented
Sep 9, 2022
•
edited
Loading
edited
- closes #BUG: Calling sample() on an empty GroupbyDataFrame returns ValueError instead of an empty DF #48459
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
Looks pretty good. Could use a whatsnew note in |
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, small request
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.
Forgot to submit the request.
pandas/tests/groupby/test_sample.py
Outdated
result = DataFrame({"a": [], "b": []}) | ||
expected = result.groupby("a").sample() |
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.
nit: result
should be the result that is being tested, expected should be what we expect. Can you switch these?
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
Thanks @Th3nn3ss |
…is called (pandas-dev#48484) * fix valueError for empty inputs for groupby sample * add to whatsnew/v1.6.0.rst doc * refactor test for groupby sample * fix duplicate assert in test