I have a dataframe as follows:
ref check result
1 age true
1 gender false
1 address false
1 nationality true
I'm trying to create a new column of 1's and 0's if the following condition is satisfied.
if age == 'true' & (gender == 'false' or address == 'false') & nationality == 'true', then 1 else 0.
This is the code that I have
df['test']= ((df['check']=='age' & df['result']=='true') & ((df['check']=='gender' / df['check']=='address') & df['result']=='false') & (df['check']=='nationality' & df['result']=='true')).astype('int')
But it doesn't work.