I have a dataframe like this
| Student ID | Subject | SID | Result |
|---|---|---|---|
| 101 | English | 1 | Pass |
| 101 | English | 1 | Pass |
| 101 | Mathematics | 3 | Pass |
| 101 | Mathematics | 3 | Pass |
| 101 | Mathematics | 33 | Fail |
| 101 | Mathematics | 33 | Fail |
| 102 | English | 1 | Pass |
| 102 | English | 1 | Pass |
| 102 | Mathematics | 3 | Fail |
| 102 | Mathematics | 3 | Fail |
I want an output like this
| Subject | SID | Pass | Fail | Failed_student_ID |
|---|---|---|---|---|
| English | 1 | 2 | 0 | |
| Mathematics | 3 | 1 | 1 | 102 |
| Mathematics | 33 | 0 | 1 | 101 |
I have a large dataset and want to take the result with respect to subject and subject ID on how many people passed and failed.
How do I write in python to get this kind of data frame?