Skip to content
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

groupby aggregation with skipnan=False differs from pandas #3765

Open
stress-tess opened this issue Sep 11, 2024 · 0 comments
Open

groupby aggregation with skipnan=False differs from pandas #3765

stress-tess opened this issue Sep 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@stress-tess
Copy link
Member

while working #3762, I found that the way we handle nan in columns when doing a groupby aggregation doesn't match pandas

with skipna=True (the default right now) we ignore NaN values and leave whatever the identity for that aggregation (i.e. MAX_INT when doing min, 0 when doing sum, etc). when we set this to False, we take NaN values into account but they override every other value (they end up being min and max in their segment.

This is not the best example, but it's the one that was popping up in my test

min aggregation with skipna:

>>> ak_df.groupby(group_on).min()
               nums2  nums3
nums1                      
1.0     1.000000e+00     10
3.0    1.797693e+308      9
4.0     7.000000e+00      7

>>> pd_df.groupby(group_on).min()
       nums2  nums3
nums1              
1.0      1.0     10
3.0      NaN      9
4.0      7.0      7

min aggregation without skipna:

>>> ak_df.groupby(group_on).min()
     key1    key2  nums1  nums2  nums3
0  valuew  valueA    1.0    1.0      9
1  valuex  valueB    NaN    NaN      7

>>> pd_df.groupby(group_on).min()
     key1    key2  nums1  nums2  nums3
0  valuew  valueA    1.0    1.0      9
1  valuex  valueB    4.0    7.0      7
@stress-tess stress-tess added the bug Something isn't working label Sep 11, 2024
@stress-tess stress-tess self-assigned this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant