Skip to content

BUG: DataFrame/Series.transform with list and non-list dict values #40018

Closed
@rhshadrach

Description

@rhshadrach
df = pd.DataFrame({'a': [1, 2], 'b': [1, 4], 'c': [1, 4]})
print(df.transform({'b': ['sqrt', 'abs'], 'c': 'sqrt'}))
print(df['a'].transform({'b': ['sqrt', 'abs'], 'c': 'sqrt'}))

produces

     b        c
  sqrt abs    c
0  1.0   1  1.0
1  2.0   4  2.0
          b             c
       sqrt abs         a
0  1.000000   1  1.000000
1  1.414214   2  1.414214

In each case the last column label on the 2nd level should be "sqrt" and not "a" or "c".

Metadata

Metadata

Assignees

Labels

ApplyApply, Aggregate, Transform, MapRegressionFunctionality that used to work in a prior pandas version

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions