I have script to fill in the values from a file (df4) to an existing dataframe (df3). But dataframe df3 contains already columns filled with values and those existing values are set to "NaN" with the following script:
df5 = df4.pivot_table(index='source', columns='plasmidgene', values='identity').reindex(index=df3.index, columns=df3.columns)
How can I avoid that my existing values are overwritten? Thanks
For example, I have df1
a b c d e f
1 1 30 Nan Nan Nan Nan
2 2 3 Nan Nan Nan Nan
3 16 1 Nan Nan Nan Nan
df2
1 1 d 80
2 2 e 90
3 3 c 60
And I want to create this
a b c d e f
1 1 30 Nan 80 Nan Nan
2 2 3 Nan Nan 90 Nan
3 16 1 60 Nan Nan Nan