Skip to content Skip to sidebar Skip to footer

How Can I Update Pandas Dataframe Just Keep Original One At Left Upper Corner?

I have a situation like that, one original pandas dataframe, for example, like: columnA columnB 1 2 1 3 then because of updating, this t

Solution 1:

I think need combine_first which convert integer columns to floats, so added astype:

df = df1.combine_first(df2).astype(int)
print (df)
   columnA  columnB  columnC
0        1        2        2
1        1        3        3
2        1        3        3

Post a Comment for "How Can I Update Pandas Dataframe Just Keep Original One At Left Upper Corner?"