Assume I have the following raw dataframe composes of some students information:
STUDENT_ID SEMESTER COURSE_NAME
50694 21 X1
50694 21 X2
50285 21 X3
51442 21 X4
51600 21 X5
50285 21 X6
50494 21 X7
50494 21 X8
50802 21 X9
50802 21 X10
50802 21 X11
50285 21 X12
I want to (1) group them by the STUDENT_IDso that each student's courses are group together, to look like this:
STUDENT_ID SEMESTER COURSE_NAME
50694 21 X1
50694 21 X2
50494 21 X7
50494 21 X8
50285 21 X3
50285 21 X6
50285 21 X12
50802 21 X9
50802 21 X10
50802 21 X11
51442 21 X4
51600 21 X5
And (2) split them by a specifc value in the STUDENT_ID column, say 50802 to get:
STUDENT_ID SEMESTER COURSE_NAME
50694 21 X1
50694 21 X2
50494 21 X7
50494 21 X8
50285 21 X3
50285 21 X6
50285 21 X12
and
STUDENT_ID SEMESTER COURSE_NAME
50802 21 X9
50802 21 X10
50802 21 X11
51442 21 X4
51600 21 X5
Any help is highly appreciated.