Hi,
I need to merge this two dataframes:
df1
I need to merge this two dataframes:
df1
pais año cantidad 0 Chile 2000 10 1 Chile 2001 11 2 Chile 2002 12df2
pais año cantidad 0 Chile 1999 0 1 Chile 2000 0 2 Chile 2001 0 3 Chile 2002 0 4 Chile 2003 0Right now I'm trying this code:
df=pd.merge(df1,df2,on=['pais','año','cantidad'],how='outer')And getting this result:
pais año cantidad 0 Chile 2000 10 1 Chile 2001 11 2 Chile 2002 12 3 Chile 1999 0 4 Chile 2000 0 5 Chile 2001 0 6 Chile 2002 0 7 Chile 2003 0Which is the simply union of both df's. I need something that produces this result:
pais año cantidad 0 Chile 1999 0 1 Chile 2000 10 2 Chile 2001 11 3 Chile 2002 12 4 Chile 2002 0 5 Chile 2003 0Any ideas? Thank!!