Comparing multiple column to create score in ascending way,

I have one table in excel

name age marks weight
a 2 20 01
b 1 17 02
c 5 15 04
d 8 25 01

STAGE 1

  • sort age column with high to low age values and create score
name age score
d 8 4
c 5 3
a 2 2
b 1 1

STAGE 2

  • sort age column with high to low marks values and create score
name marks score
d 25 4
a 20 3
b 17 2
c 15 1

STAGE 3

  • sort age column with high to low weight values and create score
name weight score
c 4 4
b 2 3
d 1 2
a 1 1

NOTE : In any case, if values are same then they will be ranked based on priorities as age->marks->weight

STAGE 4 :

CALCULATE TOTAL SCORE IN ASCENDING

name score rank
d 10 1
b 9 3
c 8 2
a 6 4

Is there any easy solution for this problem in pandas or any other module?



Read more here: https://stackoverflow.com/questions/66991748/comparing-multiple-column-to-create-score-in-ascending-way

Content Attribution

This content was originally published by Sam at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: