I have a dataframe which has Student IDs and their respective stage score.
I want to find the stage where student got dropped i.e. in which stage did the first zero score appeared. And then update the corresponding stage flag = 1 .Below is the sample data :
StuID | Stage1 | Stage2 | Stage3 | Stage4 | S1Flag |S2Flag |S3Flag | S4Flag
Ak | 80.1 | 23.3 | 0 | 0 | 0 | 0 | 1 | 0
XF | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0
WE | 23 | 34 | 43 | 34 | 0 | 0 | 0 | 0
For above Data , for StuID = 'AK' , the first zero appeared in stage 3 so S3 Flag is changed to 1 .For StuID = 'XF' , the first zero appeared in stage 1 , so S1 flag is updated as 1 . And goes o for other rows as well.