df_outer = pd.merge(df1, df2, on='id', how='outer') df_inner = pd.merge(df1, df2, on='id', how='inner')