I have two dataframes:
df1 (index is date):
a b
1900-01-01 1 2
1900-01-02 1 3
1900-01-03 3 3
df2 (index is int):
c
0 3
1 1
after merge:
a b d
1900-01-01 1 2 3
1900-01-02 1 3 1
1900-01-03 3 3
Which function should I use?
Adding values and using at
df1.at[:len(df2),'d']=df2.c.values
df1
Out[1200]:
a b d
1900-01-01 1 2 3.0
1900-01-02 1 3 1.0
1900-01-03 3 3 NaN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With