Reputation: 99
I have two dataframes:
a:
TransID Currency
1 CAD
2 USD
b:
TransID Currency
3 CAD
4 EUR
The condition is if two TransIDs have a common currency, print the output as a pair of the two, i.e. in this case the output should be -
(1,3)
Upvotes: 0
Views: 44
Reputation: 88226
You could merge
and then obtain lists from the results:
a.merge(b, on='Currency').filter(like='Trans').values.tolist()
# [[1, 3]]
Upvotes: 1