<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Rank features by Field A for each unique value in Field B in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416792#M18544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Dan. I downloaded and tried Rank by field(s) last night, thinking, like you, that it would do this. But it just produced an overall ranked list, rather than rankings for each unique parcel number.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 May 2020 17:08:47 GMT</pubDate>
    <dc:creator>Welch_Nicolas</dc:creator>
    <dc:date>2020-05-26T17:08:47Z</dc:date>
    <item>
      <title>Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416790#M18542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies in advance if this has been asked and answered elsewhere, but I couldn't find it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table of parcel lot lines. I've sorted them by parcel number and length. Now I need to add a field that ranks them by length for each unique parcel, so it would look something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; width: 69.5489%;"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel number&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Length&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;RankByLength&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;30&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;35&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;100&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;102&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;38&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;40&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;90&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 25%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Parcel2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 17%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;91&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 21.5489%;"&gt;&lt;SPAN style="font-size: 13px;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would think it's a pretty small bit of code to do it, but nevertheless still beyond my capabilities.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 16:34:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416790#M18542</guid>
      <dc:creator>Welch_Nicolas</dc:creator>
      <dc:date>2020-05-26T16:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416791#M18543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/docs/DOC-14928-free-tools-for-arcgis-pro-table-tools"&gt;https://community.esri.com/docs/DOC-14928-free-tools-for-arcgis-pro-table-tools&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rank by field(s) might work, if not, let me know and I will see if it can be tweaked&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 16:52:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416791#M18543</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-05-26T16:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416792#M18544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Dan. I downloaded and tried Rank by field(s) last night, thinking, like you, that it would do this. But it just produced an overall ranked list, rather than rankings for each unique parcel number.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 17:08:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416792#M18544</guid>
      <dc:creator>Welch_Nicolas</dc:creator>
      <dc:date>2020-05-26T17:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416793#M18545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmmm I would have to throw in a select by attribute into the mix then to query by the primary column, then aggregate the results later.&lt;/P&gt;&lt;P&gt;I won't get to that for a while, but if you had only a few cases of the parcel column, that would be the procedure...get the individual ranked listings, then merge them together.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 19:52:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416793#M18545</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-05-26T19:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416794#M18546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Unfortunately there about 160,000 parcels.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Using Frequency, I have a field with the count of parcel lines for each parcel. Is there a simple code block that could do this using Calculate Field? Conceptually it seems simple: something that adds one iteratively until the rank = the line frequency, then restart at 1. But I don't have the knowledge to generate that code.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 20:00:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416794#M18546</guid>
      <dc:creator>Welch_Nicolas</dc:creator>
      <dc:date>2020-05-26T20:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416795#M18547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is pretty shoddy code i'm sure, but it should do the job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whack this into the pre-logic script box (python)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pn = 0&lt;BR /&gt;rank = 1&lt;BR /&gt;def func(parcel_number):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global pn&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global rank&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if pn == 0:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pn = parcel_number&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif parcel_number == pn:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rank += 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = rank&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pn = parcel_number&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rank = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return result&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then pass in:&lt;/P&gt;&lt;P&gt;func(!Parcel_number!)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or whatever you parcel field is, this of course depends upon your fields being sorted, if not you will probably be best with an update cursor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 20:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416795#M18547</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-26T20:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416796#M18548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field Calculator doesn't honor any sorting from an open table view in Pro, so this might work but could very likely give incorrect results as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 20:44:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416796#M18548</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-05-26T20:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416797#M18549</link>
      <description>&lt;P&gt;This should work for you in the interactive Python window (just fill in value for tbl):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from itertools import count, groupby

tbl = # path to feature class/table or name of layer/table view
fields = ["ParcelNumber", "Length", "RankByLength"]
sql = "ORDER BY ParcelNumber, Length"
with arcpy.da.UpdateCursor(tbl,fields, sql_clause=(None,sql)) as cur:
    for k,g in groupby(cur, key=lambda x: x[0]):
        ctr = count(1)
        for row in g:
            cur.updateRow(row[:-1] + [next(ctr)])‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 00:19:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416797#M18549</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-20T00:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416798#M18550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WOW. This worked brilliantly. Thank you!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is all part of a ModelBuilder model, so I'm taking this opportunity to learn how to create and add scripts in ModelBuilder.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 21:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416798#M18550</guid>
      <dc:creator>Welch_Nicolas</dc:creator>
      <dc:date>2020-05-26T21:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416799#M18551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please Mark Correct a response if it answered your question so the question can be closed out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 22:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/416799#M18551</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-05-26T22:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rank features by Field A for each unique value in Field B</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/1210980#M59676</link>
      <description>&lt;P&gt;This is great!&amp;nbsp; I've been looking for something like this, and it works brilliantly!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 22:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/rank-features-by-field-a-for-each-unique-value-in/m-p/1210980#M59676</guid>
      <dc:creator>DanielHoffman73</dc:creator>
      <dc:date>2022-09-08T22:54:37Z</dc:date>
    </item>
  </channel>
</rss>

