Last active
October 9, 2019 15:06
-
-
Save maptastik/4d43b67078040c7a45b767540c5f7c43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.DataFrame({'a': [1,2,3], 'b': [2,3,4], 'c':['dd','ee','ff'], 'd':[5,9,1]}) | |
df['e'] = df[['a', 'b', 'd']].sum(axis = 1) | |
######################### | |
## RESULT ## | |
######################### | |
# a b c d e # COLUMNS | |
# 0 1 2 dd 5 8 # ROW | |
# 1 2 3 ee 9 14 # ROW | |
# 2 3 4 ff 1 8 # ROW | |
######################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment