I don't know how to right properly the following idea: I have a dataframe that has two columns, and many many rows. I want to create a new column based on the data in these two columns, such that if there's 1 in one of them the value will be 1, otherwise 0. Something like that:
if (df['col1']==1 | df['col2']==1):
df['newCol']=1
else:
df['newCol']=0
I tried to use .loc function in different ways but i get different errors, so either I'm not using it correctly, or this is not the right solution...
Would appreciate your help. Thanks!