I want to create a column where several columns can be greater than one but one column has to be 0 at all times e.g. :
df['indicator'] = np.where(( (df['01'] > 0) | (df['02']> 0) | (df['03']> 0) | (df['04']> 0)
& (df['spend'] == 0 )), 1, 0)
I want to create this flag based on whether if either of columns 01 to 04 are greater than 0 then 1 else 0. But whilst each of these are > 0 the spend column must be kept at 0 in all cases. This means if 01 and 02 are > 0 then spend must be 0, etc.
However using the above logic i end up with cases where spend is > 0 - what am i missing ?