Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: class views django slug 
Python :: why is there a lot of numbers in python 
Python :: tkinter bind function with arguments 
Python :: python loop function 
Python :: python convert integer to signed base 2 complement 
Python :: pandas get number unique values in column 
Python :: compare list and dataframe in pandas 
Python :: get_int python 
Python :: pyplot histogram labels in center 
Python :: Return an RDD with the keys of each tuple. 
Python :: how to use visualize_runtimes 
Python :: how to make a ip tracker in python 
Python :: how to make a time limit using renpy 
Python :: wxpython menu callback stackoverflow 
Python :: queryset o que é 
Python :: from wireframe GUI design to python tkinter 
Python :: python update pip windows 
Shell :: linux check if x11 
Shell :: check nginx status 
Shell :: the windows subsystem for linux component is not enabled 
Shell :: upgrade matplotlib version 
Shell :: apache check config 
Shell :: restart redis ubuntu 
Shell :: install grunt mac 
Shell :: undo git 
Shell :: spigot start.bat 
Shell :: yarn install windows 
Shell :: git username 
Shell :: remove xampp from ubuntu 
Shell :: check my ubuntu version 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =