simpatico
simpatico

Reputation: 11087

sum() got an unexpected keyword argument 'axis'

clean_df = clean_df.groupby(by=index_keys).sum(axis=1, numeric_only=True)

throws

sum() got an unexpected keyword argument 'axis'

I understand from related questions that this has to do with updating packages. How to find out which package is having the problem?

$ pip show pandas
Name: pandas
Version: 1.2.0
>python -m pip check
No broken requirements found.

Upvotes: 1

Views: 8120

Answers (2)

Tejashree
Tejashree

Reputation: 1

Try this
df=df.groupby('columnname').sum(numeric_only=True, min_count=0)
print(df.sum(axis=1))

Upvotes: 0

Mykola Zotko
Mykola Zotko

Reputation: 17824

As pointed in comments the method groupby returns the object GroupBy. The method sum that you can use with GroupBy doesn't have the parameter axis:

GroupBy.sum(numeric_only=True, min_count=0)

Upvotes: 5

Related Questions