I am trying to join to data frames. They look like this
DF1 = ID COUNTRY YEAR V1 V2 V3 V4 12 USA 2012 x y z a 13 USA 2013 x y z a 14 RUSSIA 2012 x y z a DF2 = ID COUNTRY YEAR TRACT 9 USA 2000 A 13 USA 2013 B The desired end goal is:
DF3 = ID COUNTRY YEAR V1 V2 V3 V4 TRACT 9 USA 2000 A 12 USA 2012 x y z a 13 USA 2013 x y z a B 14 RUSSIA 2012 x y z a I've been trying to use the pd.merge and the .join function with the on='outer' setting to no success
df3 = pd.merge(df1,df2,how='outer',left_on=['ID','Country','Year'],right_on=['ID',"Country","Year"])