Suppose I have a dataframe as below:
df = pd.DataFrame({'a':[1,2,3,4],'b':[2,3,4,5],'c':[3,4,5,6],'d':[5,3,2,4]})
I want to check if elements in column d exist elsewhere in its corresponding row. So the outcome I want is
[False, True, False, True]
Towards that end, I used
df.apply(lambda x: x['d'] in x[['a','b','c']], axis=1)
but this is somehow giving me [False, False, False, False].