Skip to content

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

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

discort
Copy link
Contributor

@discort discort commented Aug 22, 2018

tm.assert_frame_equal(result, expected)

# Testing normal func
result = df.groupby('A', as_index=False, sort=False)\
Copy link
Member

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))
Copy link
Member

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

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite Groupby labels Aug 22, 2018
@codecov
Copy link

codecov bot commented Aug 22, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@fa47b8d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #22467   +/-   ##
=========================================
  Coverage          ?   92.03%           
=========================================
  Files             ?      169           
  Lines             ?    50780           
  Branches          ?        0           
=========================================
  Hits              ?    46737           
  Misses            ?     4043           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.44% <ø> (?)
#single 42.22% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa47b8d...f2ae63c. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Aug 23, 2018

any idea where this was fixed?

@jreback jreback added this to the 0.24.0 milestone Aug 23, 2018
# 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)\
Copy link
Member

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?

@WillAyd
Copy link
Member

WillAyd commented Aug 24, 2018

@jreback not sure nothing logically sticks out. Would have to bisect to see

@discort
Copy link
Contributor Author

discort commented Aug 27, 2018

@WillAyd

@WillAyd
Copy link
Member

WillAyd commented Aug 28, 2018

@discort can you merge in from master to see if that fixes the CircleCI failure?

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm @jreback

@jreback jreback merged commit d1986fd into pandas-dev:master Aug 29, 2018
@jreback
Copy link
Contributor

jreback commented Aug 29, 2018

thanks!

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Testing pandas testing functions or related to the test suite
Projects
None yet
3 participants