eq, drop pop, neech :
mask = df.eq(df.pop('target'), axis=0)
print (mask)
A B C
0 False True False
1 False False False
2 False False True
, True, any:
mask = df.eq(df.pop('target'), axis=0).any(axis=1)
print (mask)
0 True
1 False
2 True
dtype: bool
df['new'] = df.eq(df.pop('target'), axis=0).any(axis=1)
print (df)
A B C new
0 bridge cat brush True
1 dog cat shoe False
2 cat shoe bridge True
, isin:
mask = df.isin(df.pop('target').values.tolist())
print (mask)
A B C
0 True True True
1 False True False
2 True False True
, True all:
df['new'] = df.isin(df.pop('target').values.tolist()).all(axis=1)
print (df)
A B C new
0 bridge cat brush True
1 dog cat shoe False
2 cat shoe bridge False