I am having some issues to change values in a column. My dataset has the following columns
Index(['Date', 'Name', 'Surname', 'Verified Account', 'Col1', 'Col2', 'Col3',
'Col4', 'Col5'],
dtype='object')
'Verified Account', 'Col1', 'Col2', 'Col3','Col4', 'Col5'
have rows with value 'True'/'False'
.
Right now 'Verified Account'
is based only on values from Col1
. I would like to update it including all the other columns, i.e.:
if 'Col1' or 'Col2' or 'Col3' or 'Col4' or 'Col5'
have values 'True'
, then 'Verified Account'
has value 'True'
else 'Verified Account'
has value 'False'
.
I have tried with:
df['Verified Account'] = df.apply(lambda x: 1 if df['Col1']=='True' or df['Col2']== 'True' or df['Col3']=='True' or df['Col4']== 'True' or df['Col5']=='True' else 'False')
but I have got the following error:
TypeError: Cannot perform 'rand_' with a dtyped [bool] array and scalar of type [bool]
How can I fix it?