Reputation: 11087
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
Reputation: 1
Try this
df=df.groupby('columnname').sum(numeric_only=True, min_count=0)
print(df.sum(axis=1))
Upvotes: 0
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