sectechguy
sectechguy

Reputation: 2117

Pandas Using index of pandas dataframe to update another dataframe on same index

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

Upvotes: 0

Views: 556

Answers (1)

sectechguy
sectechguy

Reputation: 2117

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'])

Upvotes: 1

Related Questions