pandas new column from others

Solutions on MaxInterview for pandas new column from others by the best coders in the world

showing results for - "pandas new column from others"
Andrés
21 Jun 2020
1import pandas as pd
2
3#Here a and b are existing columns
4
5df['c'] = df.apply(lambda row: row.a + row.b, axis=1)
6df
7#    a  b  c
8# 0  1  3  4
9# 1  2  4  6
10