I have the following student and grade data. I want to create a Marks column but I have conditions for selecting the marks of those subjects which the student repeated.
The condition is
For a given student, if the subject is repeated, I want to only consider the 2nd Attempt even if marks in the second Attempt can be lowered than 1st Attempt. This subject could be repeated in the same academic year or the next academic year. I have given a sample for 1 student but I want to do this for 1000+ students.
How to create the correct code for the following?
1. How to create the 'Repeated Attempts' column?
2. How to create 'Marks to be considered' column and drop the rows in the 'Marks to be considered' columns which has the value 'Not considered'?
The condition is
For a given student, if the subject is repeated, I want to only consider the 2nd Attempt even if marks in the second Attempt can be lowered than 1st Attempt. This subject could be repeated in the same academic year or the next academic year. I have given a sample for 1 student but I want to do this for 1000+ students.
How to create the correct code for the following?
1. How to create the 'Repeated Attempts' column?
2. How to create 'Marks to be considered' column and drop the rows in the 'Marks to be considered' columns which has the value 'Not considered'?
Row | Student ID | Year | Subject | Grade | Repeated Attempts | Marks to be considered |
1 | ID1 | 2010 | Maths | 58 | No repeat | 58 |
2 | ID1 | 2010 | Eng | 35 | 1st Attempt | Not considered |
3 | ID1 | 2010 | Eng | 48 | 2nd Attempt | 48 |
4 | ID1 | 2010 | Science | 32 | 1st Attempt | Not considered |
5 | ID1 | 2011 | Science | 50 | 2nd Attempt | 50 |
6 | ID1 | 2011 | Maths-II | 53 | No repeat | 53 |
7 | ID1 | 2011 | Eng-II | 45 | No repeat | 45 |
8 | ID1 | 2011 | Sci-I | 52 | No repeat | 52 |
9 | ID1 | 2012 | Maths-III | 56 | No repeat | 56 |
10 | ID1 | 2012 | Eng-III | 49 | No repeat | 49 |
11 | ID1 | 2012 | Sci-III | 38 | 1st Attempt | Not considered |
12 | ID1 | 2013 | Sci-III | 34 | 2nd Attempt | 34 |
Comment