Skip to content Skip to sidebar Skip to footer

Join Dataframes By Column Values Pandas

I have two data frames df1 and df2 taken from different databases. Each item in the dataframes is identified by an id. df1 = pd.DataFrame({'id':[10,20,30,50,100,110],'cost':[100,0,

Solution 1:

I think you can use merge, default parameter how='inner' is omited:

print (pd.merge(df1,df2,on='id'))
   cost   id name
0   100   10    a
1   300   30    j
2   400  100    k
3   140  110    g

Post a Comment for "Join Dataframes By Column Values Pandas"