BUG: GroupBy.size incorrect for axis=1 · Issue #45715 · pandas-dev/pandas (original) (raw)

@rhshadrach

Pandas version checks

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

Installed Versions

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