Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

I have a dataframe with values like

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 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.

1 Answer

0 votes
by (41.4k points)

The answer for this is very simple:

df['C'] = df['A'] + df['B']

Browse Categories

...