Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

removing rows dataframe not in another dataframe using two columns

import pandas as pd

USERS = pd.DataFrame({'email':['a@g.com','b@g.com','b@g.com','c@g.com','d@g.com']})
print (USERS)
     email
0  a@g.com
1  b@g.com
2  b@g.com
3  c@g.com
4  d@g.com

EXCLUDE = pd.DataFrame({'email':['a@g.com','d@g.com']})
print (EXCLUDE)
     email
0  a@g.com
1  d@g.com
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #removing #rows #dataframe #dataframe #columns
ADD COMMENT
Topic
Name
4+7 =