0

I wish to update column A in dfA with column B in dfB on index overlap

dfA

     A
1    1
2    1
3    1
4    1

dfB

     B
3    2
4    2
5    2
6    2

Desired result:

     A
1    1
2    1
3    2
4    2

What is the simplest way to do this?

1 Answer 1

2

Try with update

dfA.update(dfB.rename(columns = {'B':'A'}))
Sign up to request clarification or add additional context in comments.

2 Comments

Works well. Thank you!
I was thinking of the same thing too! But slower 9 mins ;p

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.