<?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: Duplicate Values in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826643#M393</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brian, thank you so much, it worked perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 20 Sep 2014 18:10:20 GMT</pubDate>
    <dc:creator>RickWarner</dc:creator>
    <dc:date>2014-09-20T18:10:20Z</dc:date>
    <item>
      <title>Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826640#M390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table that has one field with duplicate values. Is there any code that will label the duplicates 0, 1, 2, 3, 4 ..., rather than 0 and 1 as the following code does which I've found on ESRI's web site.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python parser, and use&amp;nbsp; then use the following codebook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uniqueList = []&lt;/P&gt;&lt;P&gt;def isDuplicate(inValue):&lt;/P&gt;&lt;P&gt;&amp;nbsp; if inValue in uniqueList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueList.append(inValue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;isDuplicate(!PCN!)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 17:08:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826640#M390</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-09-19T17:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826641#M391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure I understand. You are saying that you have a field that has values like 1,2,2,3,4,4,5 etc. and you want 1,2,3,4,5,6 what is the value of this. Why not just use the OID if you need a UID (unique identifier). If this will not work-&amp;nbsp; what you want can be done with python using an UpdateCursor: here is info on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then just update the row with a count variable. and increment it each time though the loop. count += 1 i.e. count = count + 1 &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 17:19:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826641#M391</guid>
      <dc:creator>forestknutsen1</dc:creator>
      <dc:date>2014-09-19T17:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826642#M392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1411151089789334 jive_text_macro" jivemacro_uid="_1411151089789334"&gt;
&lt;P&gt;uniqueList={}&lt;/P&gt;
&lt;P&gt;def isDuplicate(inValue):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global uniqueList&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if inValue in uniqueList.keys():&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueList[inValue] += 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return uniqueList[inValue]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueList[inValue] = 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return uniqueList[inValue]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the Python Parser, insert the following into the code block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will perform the same operation as the above, but will increment the duplicate records as 0, 1, 2, 3 ... and then revert to 0 when it hits the next unique value.&lt;/P&gt;&lt;P&gt;At the end you would then use the isDuplicate(!&amp;lt;Your Field Name&amp;gt;!)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 18:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826642#M392</guid>
      <dc:creator>BrianCarson2</dc:creator>
      <dc:date>2014-09-19T18:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826643#M393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brian, thank you so much, it worked perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Sep 2014 18:10:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826643#M393</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-09-20T18:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826644#M394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this thread still remains open, if a solution was provided please select the correct answer to finalize the discussion&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 00:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826644#M394</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-10-17T00:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Values</title>
      <link>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826645#M395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This best answer which worked perfectly was by B Carslon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much…&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Oct 2014 00:35:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/duplicate-values/m-p/826645#M395</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-10-18T00:35:56Z</dc:date>
    </item>
  </channel>
</rss>

