Skip to content

BUG: DataFrame.agg and apply with 'size' returns a scalar #39934

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
rhshadrach opened this issue Feb 20, 2021 · 0 comments · Fixed by #39935
Closed

BUG: DataFrame.agg and apply with 'size' returns a scalar #39934

rhshadrach opened this issue Feb 20, 2021 · 0 comments · Fixed by #39935
Assignees
Labels
API - Consistency Internal Consistency of API/Behavior Apply Apply, Aggregate, Transform, Map Bug
Milestone

Comments

@rhshadrach
Copy link
Member

Compare

df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print(df.apply('size'))
print(df.apply(['size']))
print('---')
print(df.agg('size'))
print(df.agg(['size']))

gives

6
      a  b
size  3  3
---
6
      a  b
size  3  3

agg/apply should operate on rows/columns.

@rhshadrach rhshadrach added Bug Apply Apply, Aggregate, Transform, Map API - Consistency Internal Consistency of API/Behavior labels Feb 20, 2021
@rhshadrach rhshadrach self-assigned this Feb 20, 2021
@jreback jreback added this to the 1.3 milestone Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Apply Apply, Aggregate, Transform, Map Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants