Answers for "removing rows dataframe not in another dataframe using two columns"

0

removing rows dataframe not in another dataframe using two columns

import pandas as pd

USERS = pd.DataFrame({'email':['[email protected]','[email protected]','[email protected]','[email protected]','[email protected]']})
print (USERS)
     email
0  [email protected]
1  [email protected]
2  [email protected]
3  [email protected]
4  [email protected]

EXCLUDE = pd.DataFrame({'email':['[email protected]','[email protected]']})
print (EXCLUDE)
     email
0  [email protected]
1  [email protected]
Posted by: Guest on August-29-2021
0

removing rows dataframe not in another dataframe using two columns

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)
Posted by: Guest on August-29-2021

Code answers related to "removing rows dataframe not in another dataframe using two columns"

Python Answers by Framework

Browse Popular Code Answers by Language