Skip to content

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

Closed
@rhshadrach

Description

@rhshadrach

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.

Metadata

Metadata

Assignees

Labels

API - ConsistencyInternal Consistency of API/BehaviorApplyApply, Aggregate, Transform, MapBug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions