Pandas: Aggregate same column twice -> _agg_2dim() takes 1 positional argument but 2 were given

I can't figure out why i get the error message

"_agg_2dim() takes 1 positional argument but 2 were given"

The aggregation error in the .init of class

I want to put empasis on the variable

aggregation_dict = 
{'val0': NamedAgg(column='HW_Wirkstrom_Max', aggfunc='max'),
 'val1': NamedAgg(column='HW_Wirkstrom_Max', aggfunc='max')}

if instead, i choose two different columns, so

aggregation_dict = 
{'val0': NamedAgg(column='HW_Wirkstrom_Max', aggfunc='max'),
 'val1': NamedAgg(column='HW_Wirkstrom_Schnitt', aggfunc='max')}

the code runs fine.

It also runs fine in case of the same column aggregated two times, if i run the snippet directly in a notebook: enter image description here

This has been driving me crazy for the last few hours, i am not sure how to represent a working minimal example, as i can't reproduce the error in a notebook but only happens when calling an external class.

Read more here:

Content Attribution

This content was originally published by Simon B at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: