0

I have 2 pandas dataframes. I am trying to update df with values from df2 based on matching index's.

df
    Url_Sub_Fld     ip
0   tel             na
1   li              na
2   192.22.25.26    192.22.25.26

df2
   Url_Sub_Fld
1  test_string

Desired output:

df
    Url_Sub_Fld     ip
0   tel             na
1   test_string     na
2   192.22.25.26    192.22.25.26
1
  • 4
    df.update(df2) works fine or even final=df2.combine_first(df) , note update is an inplace operation. Commented Sep 18, 2019 at 12:55

1 Answer 1

1

Its been 22 hours and no Answers so I will post anky_91's comment as it is what I used to solve my problem.

df.update(df2['Url_Sub_Fld'])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.