0

I would like to have all the records in a table given a rank value based on the values in another field. The caveat is that there are tied rankings. For example in the attached screen cap, EPDO is the data to rank, and RANK_EPDO is field to store the rank. Anyone aware of any tools in ArcGIS that will accomplish this?

enter image description here

  • You could possibly do this with calculate field. What is the formula (rules) of ranking? Is it standard deviation? 1 to 10 with even spread? Highest 10 then subsequent values sorted by lots of 10? Random number? How do you turn EPDO into RANK_EPDO? – Michael Stimson Apr 16 '18 at 23:04
  • It's a straight ranking. Highest EPDO gets ranked 1. The next highest get 2. If EPDO is tied they get the same rank value. The ranks range from 1 to however many unique values there are. The following python code works if the table is permanently sorted first w/ the Sort Tool. – Mercator Apr 19 '18 at 16:36
2

The following python code works if the table is permanently sorted first w/ the Sort Tool.

   # Codeblock:

    rank = 0
    lastValue = None

    def getNextRank(value):
      global rank
      global lastValue
      if value == lastValue:
        return rank
      else:
        rank += 1
        lastValue = value
        return rank

    # Main part, RANK_EPDO =


    getNextRank(!EPDO!)

RANK_EPDO = getNextRank(!EPDO!)

  • 1
    Can you edit your answer to include that the table needs to be permanently sorted first with the sort tool? That way people don't need to read through the comments. – Joss Apr 19 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.