Back
I have a dataframe with values like
A B1 42 63 9
A B
1 4
2 6
3 9
I need to add a new column by adding values from column A and B, like
A B C1 4 52 6 83 9 12
A B C
1 4 5
2 6 8
3 9 12
I believe this can be done using lambda function, but I can't figure out how to do it.
The answer for this is very simple:
df['C'] = df['A'] + df['B']
31k questions
32.8k answers
501 comments
693 users