Mar-19-2023, 04:15 AM
Hi all, i use this code to rank a list, the problem is if there is a tie break it gives inaccurate info, how can i fix this so tie breaks will be based on original list order.
list1 = {} for i, e in enumerate(change): list1[e] = i rank = 1 for key in sorted(list1.keys(), reverse=FALSE): # These lines rank a list from high to low but doesn't sort change[list1.get(key)] = rank rank = rank + 1