Reputation: 63
I'm trying to compare two different columns from two different DataFrames.
test_website1
Domain
0 www.google.com
1 www.facebook.com
2 www.yahoo.com
test_website2
Domain
0 www.bing.com
1 www.instagram.com
2 www.google.com
testlist = []
def match_domain(col1, col2):
for a in col1:
v1 = a
for b in col2:
v2 = b
if v2 == v1:
testlist.append(v1)
test_website1 = df_website_test1['Domain']
test_website2 = df_website_test2['Domain']
When I call:
match_domain(test_website1, test_website2)
The output should be just "www.google.com"
but instead this is the output I get.
['www.google.com', 'www.facebook.com', 'www.yahoo.com']
Completely Stuck! Thank you for your help in advance!
Upvotes: 2
Views: 83