-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TEST: groupby(as_index=False, sort=False).aggregate formerly (?) gave unexpected results with a list-like function #22467
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
tm.assert_frame_equal(result, expected) | ||
|
||
# Testing normal func | ||
result = df.groupby('A', as_index=False, sort=False)\ |
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.
Is this not already tested elsewhere? No need to duplicate if so
result = df.groupby('A', as_index=False, sort=False)\ | ||
.aggregate({'B': lambda x: list(x)}) | ||
expected = df.copy() | ||
expected['B'] = df['B'].apply(lambda x: list(x)) |
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.
Would be preferable to just manually construct the expected output here for both readability and risk mitigation. A smaller example (say range(3)
) should suffice if it makes things easier
Codecov Report
@@ Coverage Diff @@
## master #22467 +/- ##
=========================================
Coverage ? 92.03%
=========================================
Files ? 169
Lines ? 50780
Branches ? 0
=========================================
Hits ? 46737
Misses ? 4043
Partials ? 0
Continue to review full report at Codecov.
|
any idea where this was fixed? |
# GH 18473 | ||
df = pd.DataFrame({'A': [str(x) for x in range(3)], | ||
'B': [str(x) for x in range(3)]}) | ||
result = df.groupby('A', as_index=False, sort=False)\ |
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 use implicit line breakage here instead?
@jreback not sure nothing logically sticks out. Would have to bisect to see |
@discort can you merge in from master to see if that fixes the CircleCI failure? |
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 @jreback
thanks! |
git diff upstream/master -u -- "*.py" | flake8 --diff