Skip to content
Advertisement

How to add an entire Column in Dataframe in Pandas using another Dataframe

I have 2 dataframes. I want to update the 1st dataframe(df1) by adding the column values w.r.t A from 2nd dataframe(df2). I have already created new column(C) at the index(which will be a variable).

df1

JavaScript

df2

JavaScript

result df

JavaScript

Advertisement

Answer

You need an outer join:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement