Hi I have df like this:
df = pd.DataFrame({'CaseNo':[1,1,1,1,2,2,3,3,3,4,4],
'Category':['A','A','IOU','A','B','B','IOU','IOU','IOU','C','IOU']})
I'd like to label CaseNo col based on this condition:
For each CaseNo, if there is an occurrence of value 'IOU' in Category column with any values (except 'IOU') preceding it - label 'YES', else label 'NO'.

