Do you want to add column Aand column Band save the result in C? Then you can make it easier:
df.C = df.A + df.B
@EdChum , apply 0, ( 1 ):
>>> df.apply(lambda s: s)[:3]
A B C D
0 57.890858 72.344298 16.348960 84.109071
1 85.534617 53.067682 95.212719 36.677814
2 23.202907 3.788458 66.717430 1.466331
:
>>> df.apply(lambda s: s[0] + s[1])
A 143.425475
B 125.411981
C 111.561680
D 120.786886
dtype: float64
axis=1:
>>> df.apply(lambda s: s[0] + s[1], axis=1)
0 130.235156
1 138.602299
2 26.991364
3 143.229523
...
98 152.640811
99 90.266934
, :
>>> (df.apply(lambda s: s[0] + s[1], axis=1) ==
df.apply(lambda s: s['A'] + s['B'], axis=1))
0 True
1 True
2 True
3 True
...
98 True
99 True