df = pd.merge(df1, df2, how='left', indicator='Exist') df['Exist'] = np.where(df.Exist == 'both', True, False) df = df[df['Exist']==True].drop(['Exist','z'], axis=1)