I want to create conditions as below to evaluate the HUB Status as ...
- CUR_RULE=DEFAULT and PREV_RULE=DEFAULT, then ok.
- CUR_RULE=DEFAULT and PREV_RULE!=DEFAULT, then not ok.
- CUR_RULE!=DEFAULT and PREV_RULE=DEFAULT, then ok.
- CUR_RULE!=DEFAULT and PREV_RULE!=DEFAULT, then ok.
I am trying to run the code below:
df3=df1[df1['STATUS']=='CHANGED']
df3.insert(7, 'HUB STATUS','')
df3.insert(8, 'COMMENT','')
if df3[df3['CUR_RULE']=='DEFAULT'] and df3[df3['PREV_RULE']=='DEFAULT']:
df3['HUB STATUS']='OK'
elif df3[df3['CUR_RULE']=='DEFAULT'] and df3[df3['PREV_RULE']!='DEFAULT']:
df3['HUB STATUS']='NOT OK'
elif df3[df3['CUR_RULE']!='DEFAULT'] and df3[df3['PREV_RULE']=='DEFAULT']:
df3['HUB STATUS']='OK'
else:
df3['HUB STATUS']='NOT OK'
I am getting this error:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()