1

I have a question that might be similar to other "pivot" type questions but it is a very different. I am not looking at flattening, transposing or pivoting, but converting a ranking into a row.

Imagine I have 3 calculus classes, each class has 10 students, with their exam scores.

enter image description here

and I want to rank students but display the ranked student ID in a row by class

enter image description here

How would I do this in Pandas/Python?

I could (in fact, have successful done a row-wise function to do that, but performance is very poor when you have thousands of rows)

Cheers, and many thanks in advance Nelson

0 Answers0