3

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?

1
  • The questions posted should involve an approach of what you have tried and why is it not working. Commented Dec 22, 2017 at 19:31

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.