Skip to content

BUG: GroupBy.size incorrect for axis=1 #45715

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

Closed
3 tasks done
rhshadrach opened this issue Jan 30, 2022 · 0 comments · Fixed by #45987
Closed
3 tasks done

BUG: GroupBy.size incorrect for axis=1 #45715

rhshadrach opened this issue Jan 30, 2022 · 0 comments · Fixed by #45987

Comments

@rhshadrach
Copy link
Member

rhshadrach commented Jan 30, 2022

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

df = DataFrame({'a': [1, 1, 1], 'b': 2, 'c': 3, 'd': 4, 'e': 5})
gb = df.groupby([0, 0, 0, 1, 1], axis=1)
print(df)
print()
print(gb.size())

Issue Description

I can't imagine this being a useful op, but we still shouldn't have wrong results.

   a  b  c  d  e
0  1  2  3  4  5
1  1  2  3  4  5
2  1  2  3  4  5

0    3
1    2

Expected Behavior

    0  1
0   3  2
1   3  2
2   3  2

Installed Versions

Replace this line with the output of pd.show_versions()

@rhshadrach rhshadrach added Bug Needs Triage Issue that has not been reviewed by a pandas team member Groupby and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 30, 2022
@rhshadrach rhshadrach added this to the Contributions Welcome milestone Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant