Answers for "pandas row sum"

5

pandas groupby sum

df.groupby(['Fruit','Name'])['Number'].sum()
Posted by: Guest on June-25-2020
2

pandas row sum

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

pandas sum

import pandas as pd

data = {'Month': ['Jan ','Feb ','Mar ','Apr ','May ','Jun '],
        'Bill Commission': [1500,2200,3500,1800,3000,2800],
        'Maria Commission': [3200,4100,2500,3000,4700,3400], 
        'Jack Commission': [1700,3100,3300,2700,2400,3100]
        }

df = pd.DataFrame(data,columns=['Month','Bill Commission','Maria Commission','Jack Commission'])
print (df)
Posted by: Guest on December-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language