Reputation: 862
I have two pandas DataFrames df1
and df2
:
df1: df2:
A A
1 10 2 21
2 20 3 31
5 50 4 41
6 60 5 51
and want to merge both DataFrames to the most complete one based on their indexes. The result should be the following:
df_full
A
1 10
2 20
3 31
4 41
5 50
6 60
Upvotes: 0
Views: 31
Reputation: 88266
You have combine_first
for this:
df1.combine_first(df2).astype(int)
col1
1 10
2 20
3 31
4 41
5 50
6 60
Upvotes: 3