Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas dataframe total column

import pandas as pd
my_df = pd.DataFrame({'col1':[1,2,3], 'col2':[4,5,2]})

# add total column
my_df['Total'] = my_df.sum(axis=1)

print(my_df)
 
PREVIOUS NEXT
Tagged: #pandas #dataframe #total #column
ADD COMMENT
Topic
Name
5+3 =