Answers for "pandas rows sum"

2

pandas row sum

df.sum(axis=1)
Posted by: Guest on April-04-2021
0

pandas sum

df.loc['Total'] = pd.Series(df['MyColumn'].sum(), index = ['MyColumn'])
print (df)
         X  MyColumn      Y      Z
0        A      84.0   13.0   69.0
1        B      76.0   77.0  127.0
2        C      28.0   69.0   16.0
3        D      28.0   28.0   31.0
4        E      19.0   20.0   85.0
5        F      84.0  193.0   70.0
Total  NaN     319.0    NaN    NaN
Posted by: Guest on December-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language