I have a "set" of "tuples" as follows set = {(2, 3), (2, 4), (5, 5)}
My DataFrame looks like this:
df = pd.DataFrame( {'one': [1,2,4,1], 'two' : [5,3,2,2]})
I want to check if in each line the "tuple" formed by the elements of the two series is contained in the set. The desired result would be this:
df = pd.DataFrame({'one': [1,2,4,1], 'two' : [5,3,2,2], 'three' : [False, True, False, False]})
I've tried:
df['three'] = ((df['one'], df['two']) in set)
It did not work and gave me the following error message: 'Series' objects are mutable, so they can not be hashed "
How to achieve the desired result? Thanks