You can try that maybe :
ther_cols = ['col1', 'col2', 'col3', 'col4', 'col5']
def labels(row):
elif ((row['col 6'] > 1) & (row[other_cols] < 1)).all():
row['category'] = 'Yes'
elif ((row['col 6'] >1) & (row['col 7'] >1) & (row[other_cols] <1)).all():
row['category'] = 'Maybe'
elif ((row['col 6'] <1) & (row['col 7']>1) & (row[other_cols] <1)).all():
row['category'] = 'no'
else:
row['category'] = ''
df = df.apply(labels, axis=1)
What is the size of your dataset ?
I'm sorry i can not comment I am still new here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…