I have a data frame of students id along with number of tests they have taken for each subject. I have to group it according to IDs with subjects and number of tests as map.
What I have:
Id Subject Number_of_Tests
101 Maths 6
101 Science 8
101 History 10
102 History 5
102 Maths 4
102 Science 7
What I want:
Id Tests Grade
101 {Maths:6, Science:8, History:10} A
102 {History:5, Maths:5, Science:7} B
Also, after grouping like this, I want to add one more column to this called "Grade", which is based on the newly created "Tests" Map Field. For example, if the number of tests in Maths is greater dhan 5 and if the number of tests in Science is greater than 5 and if the number of tests in History is greater than 5, then grade "A", else "B".
Could anyone please help me on this.