Hi, I have managed to extract the highest, second and third highest value, aswell as the field name of the highest value in a row. However, I´m struggling to extract the field name of the second and third highest value in a row. I used the following python code to extract highest, second and third highest values, and field name of highest:
Highest value:
maxnum([!Field1!, !Field2!, !Field3!,…])
def maxnum(fields):
fields.sort()
return fields[-1]
Field name with the highest value:
getMaxField(!Field1!,!Field2!,!Field3!)
def getMaxField(v1, v2, v3, name1, name2, name3):
maxval = max(v1,v2,v3)
if maxval == v1:
return name1
if maxval == v2:
return name2
return name3
Any suggestions on how I can rewrite the code, or use a different code, to extract field names of second and third highest value?