How about x.add(y, fill_value=0)
?
import pandas as pd
df1 = pd.DataFrame([(1,2),(3,4),(5,6)], columns=['a','b'])
Out:
a b
0 1 2
1 3 4
2 5 6
df2 = pd.DataFrame([(100,200),(300,400),(500,600)], columns=['a','b'])
Out:
a b
0 100 200
1 300 400
2 500 600
df_add = df1.add(df2, fill_value=0)
Out:
a b
0 101 202
1 303 404
2 505 606
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…