How can I insert the contents of Excel 2 into Excel 1 in Python?

Asked 2 years ago, Updated 2 years ago, 43 views

For example,

df1 and

You have df2.

How should I access the code to insert the contents of df2 into the blank of df1?

I've used the merge or concat function, but I can't write it neatly, and it doesn't come out well even if I search for it, so I'm asking for advice.

python pandas

2022-09-27 01:01

2 Answers

df1[df1.isnull()]=df2


2022-09-27 01:01

df1.combine_first(df2)


2022-09-27 01:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.