<?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: How To: Identify duplicate or unique values in ArcGIS Pro-- Update in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030726#M60127</link>
    <description>&lt;P&gt;Should have also printed the value for testing :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print(fields[i] + " - value - " + str(value) + " - Count - " + str(occ))&lt;/LI-CODE&gt;&lt;P&gt;Would be good to see your final code when you get the appending sorted within that same update cursor.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2021 21:19:16 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-02-25T21:19:16Z</dc:date>
    <item>
      <title>How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030547#M60116</link>
      <description>&lt;P&gt;&lt;A href="https://support.esri.com/en/technical-article/000023355" target="_blank"&gt;https://support.esri.com/en/technical-article/000023355&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I want to improve on the above script from ESRI that finds duplicate values and writes the values to a new field in a table. It's using an old cursor and it is very slow with large datasets. But, I'm running into problems due to lack of experience.&lt;/P&gt;&lt;P&gt;Their code verbatim for my purposes:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

'''
This script will count the number of occurences of a value in a field ("field_in") and write them to a new field ("field_out")
'''
#path to GDB goes here
arcpy.env.workspace = r"C:\pathto\DuplicateTesting.gdb\DuplicateTesting" 
#name of feature class goes here
infeature = "backup_02232021" 
field_in = "name" 
field_out = "COUNT_"+field_in
arcpy.AddField_management(infeature, field_out,"SHORT")

lista= []
cursor1=arcpy.SearchCursor(infeature)
for row in cursor1:
    i=row.getValue(field_in) 
    lista.append(i)
del cursor1, row

cursor2=arcpy.UpdateCursor(infeature)
for row in cursor2:
    i=row.getValue(field_in)
    occ=lista.count(i)
    row.setValue(field_out, occ)
    cursor2.updateRow(row)
del cursor2, row&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following is as far as I got with my improvement. It's throwing an error on the line with the i variable. How can I continue with the UpdateCursor method to put the count of each item in the fields list into its corresponding new field?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;infeature = r"C:pathto\DuplicateTesting.gdb\DuplicateTesting
fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"] 
for field_out in fields: #add new fields
    arcpy.AddField_management(infeature, "COUNT_"+field_out,"SHORT")
    
list= []
with arcpy.da.SearchCursor(infeature, fields) as cursor1:
    for row in cursor1:
        list.append(row)
    del cursor1, row
with arcpy.da.UpdateCursor(infeature, fields) as cursor2:
    for row in cursor2:
        i = row.getValue(row) #&amp;lt;-- throws AttributeError here
        occ = list.count(i)
        print(occ)
    del cursor2, row&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Traceback (most recent call last):
  File "\\gisfile\GISstaff\Jared\Python Scripts\ArcGISPro\DuplicateFields_updated.py", line 21, in &amp;lt;module&amp;gt;
    i = row.getValue(row)
AttributeError: 'list' object has no attribute 'getValue'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 17:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030547#M60116</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-25T17:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030551#M60117</link>
      <description>&lt;P&gt;try&amp;nbsp; &amp;nbsp; print(row)&lt;/P&gt;&lt;P&gt;and you will see that it isn't what getValue wants&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/row.htm" target="_blank"&gt;Row—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 17:23:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030551#M60117</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-25T17:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030597#M60120</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"] 
for field_out in fields: #add new fields
    arcpy.AddField_management(infeature, "COUNT_"+field_out,"SHORT")

#list is reserved - use soemthing else  
values_list= []
with arcpy.da.SearchCursor(infeature, fields) as cursor1:
    #dont append the row to the list, append the values
    #this isnt perfect either, throwing everything into one list,
    #ie what if someone puts a home and mobile number as the same
    #it gets counted as well, so this needs to be improved later
    for row in cursor1:
        #access each field value by the index i then append
        for i in range(0,len(fields)):
            #you access a value by a row index, this starts at 0 from the
            #first field input - i.e. "name" field values are at row[0]
            values_list.append(row[i])


#values_list is now a giant list of every value in all those fields
    
with arcpy.da.UpdateCursor(infeature, fields) as cursor2:
    for row in cursor2:
        #the same concept - loop over your fields - the original script was
        #only designed for 1 field so you need these loops (maybe!)
        for i in range(0,len(fields)):
            #get the value of the rield in the row
            value = row[i] #&amp;lt;-- throws AttributeError here
            #count how often it appears in values_list
            occ = values_list.count(i)
            #you want to know the field it occurs in also!
            #(i know you want to insert these values into the newly created
            #fields, but it will be handy to know the field
            #in the print statement for now
            #get that field value by using i as an index to access fields list

            #N.B. !!! this will print alot of values
            print(fields[i] + " Count - " + str(occ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 18:48:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030597#M60120</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-25T18:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030611#M60121</link>
      <description>&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;Thanks for the very detailed response! On the first go, it through the following error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;occ = list.count(i) #&amp;lt;-- line that threw the error

Error:
TypeError: descriptor 'count' requires a 'list' object but received a 'int'&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 19:16:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030611#M60121</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-25T19:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030620#M60123</link>
      <description>&lt;P&gt;&lt;SPAN&gt;ah right, I saw that when I posted it but thought I edited it out pretty fast.&amp;nbsp; It must still be pending or something. Then I found another mistake... Try this. I've not tested it.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;infeature = r"C:pathto\DuplicateTesting.gdb\DuplicateTesting
fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"] 
for field_out in fields: #add new fields
    arcpy.AddField_management(infeature, "COUNT_"+field_out,"SHORT")

#list is reserved - use soemthing else  
values_list= []
with arcpy.da.SearchCursor(infeature, fields) as cursor1:
    #dont append the row to the list, append the values
    #this isnt perfect either, throwing everything into one list,
    #ie what if someone puts a home and mobile number as the same
    #it gets counted as well, so this needs to be improved later
    for row in cursor1:
        #access each field value by the index i then append
        for i in range(0,len(fields)):
            #you access a value by a row index, this starts at 0 from the
            #first field input - i.e. "name" field values are at row[0]
            values_list.append(row[i])


#values_list is now a giant list of every value in all those fields
    
with arcpy.da.UpdateCursor(infeature, fields) as cursor2:
    for row in cursor2:
        #the same concept - loop over your fields - the original script was
        #only designed for 1 field so you need these loops (maybe!)
        for i in range(0,len(fields)):
            #get the value of the rield in the row
            value = row[i] #&amp;lt;-- throws AttributeError here
            #count how often it appears in values_list
            occ = values_list.count(value)
            #you want to know the field it occurs in also!
            #(i know you want to insert these values into the newly created
            #fields, but it will be handy to know the field
            #in the print statement for now
            #get that field value by using i as an index to access fields list

            #N.B. !!! this will print alot of values
            print(fields[i] + " Count - " + str(occ))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 19:24:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030620#M60123</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-25T19:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030626#M60124</link>
      <description>&lt;P&gt;Yep, running now! The range() function was what I was missing (struggling to come up with).&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 19:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030626#M60124</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-25T19:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030726#M60127</link>
      <description>&lt;P&gt;Should have also printed the value for testing :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print(fields[i] + " - value - " + str(value) + " - Count - " + str(occ))&lt;/LI-CODE&gt;&lt;P&gt;Would be good to see your final code when you get the appending sorted within that same update cursor.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 21:19:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030726#M60127</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-25T21:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030770#M60129</link>
      <description>&lt;P&gt;Been spinning my wheels. I've tried this amongst other things:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor(infeature, fields) as cursor2:
    for row in cursor2:
        for i in range(0,len(fields)):
            value = row[i] 
            occ = values_list.count(value)
            
            for field in field_out:
                cursor2.updateRow(field)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it gives me this error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  File "pathto\DuplicateFields_updated.py", line 47, in &amp;lt;module&amp;gt;
    cursor2.updateRow(field)
TypeError: sequence size must match size of the row&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 21:53:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030770#M60129</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-25T21:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030778#M60130</link>
      <description>&lt;P&gt;Share the whole script.&amp;nbsp; field_out only exists within your initial for loop (I think, but you've not shared the full script).&amp;nbsp; Also a cursor cannot update a field which is not supplied in the fields list when instantiated.&lt;/P&gt;&lt;P&gt;updateRow() method acts on a row -&amp;nbsp;updateRow(row) this updates the row.&amp;nbsp; assign a value to the field by row index then updateRow(row):&lt;/P&gt;&lt;P&gt;if first field supplied is 'name', to update this fields row in the iteration to 'apples':&lt;/P&gt;&lt;P&gt;row[0] = 'apples'&lt;/P&gt;&lt;P&gt;cursor.updateRow(row)&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"]

#list to contain the new fields
new_fields = []
for field in fields:
     field_out = "COUNT_" + field
     #add the fields to all_fields
     new_fields.append(field_out)

#list to contain all fields, this is used as fields list
#in the update cursor - to do this we just add the lists together!
all_fields = fields + new_fields&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 22:14:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030778#M60130</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-25T22:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030782#M60131</link>
      <description>&lt;P&gt;Sorry.. here's the whole script. I'm in the middle of digesting your latest post.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;infeature = r"pathto\DuplicateTesting.gdb\backup_02232021_TESTDELETE"
fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"] 
for field_out in fields: #add new fields
    arcpy.AddField_management(infeature, "COUNT_"+field_out,"SHORT")
    
values_list= []
with arcpy.da.SearchCursor(infeature, fields) as cursor1:
    #dont append the row to the list, append the values
    #this isnt perfect either, throwing everything into one list,
    #ie what if someone puts a home and mobile number as the same
    #it gets counted as well, so this needs to be improved later
    for row in cursor1:
        #access each field value by the index i then append
        for i in range(0,len(fields)):
            #you access a value by a row index, this starts at 0 from the
            #first field input - i.e. "name" field values are at row[0]
            values_list.append(row[i])

#values_list is now a giant list of every value in all those fields
    
with arcpy.da.UpdateCursor(infeature, fields) as cursor2:
    for row in cursor2:
        #the same concept - loop over your fields - the original script was
        #only designed for 1 field so you need these loops (maybe!)
        for i in range(0,len(fields)):
            #get the value of the field in the row
            value = row[i] 
            #count how often it appears in values_list
            occ = values_list.count(value)
            #you want to know the field it occurs in also!
            #(i know you want to insert these values into the newly created
            #fields, but it will be handy to know the field
            #in the print statement for now
            #get that field value by using i as an index to access fields list

            #N.B. !!! this will print alot of values
            #print(fields[i] + " - value - " + str(value) + " - Count - " + str(occ))
            field_out.append(occ)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 22:19:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030782#M60131</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-25T22:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030834#M60135</link>
      <description>&lt;P&gt;just saying ....&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/how-to-indentify-duplicate-or-unique-value-in-pro-runtimeerror/m-p/1029754/highlight/true#M60065" target="_blank"&gt;Solved: Re: How to indentify duplicate or unique value in ... - GeoNet, The Esri Community&lt;/A&gt;&amp;nbsp; numpy&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 23:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030834#M60135</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-25T23:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030950#M60141</link>
      <description>&lt;P&gt;getValue needs an indexed position, but you are giving it the whole list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it's just one field: i = row.getValue(row[0]), but you have a list of fields so you need to iterate over them to get all the name and get the count.&lt;/P&gt;&lt;P&gt;Since you are not updating anything you can use a searchcursor instead of the update.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.SearchCursor(infeature, fields) as cursor2:
    for row in cursor2:
        for fld in row:
            fldname = row.getValue(fld) # needs indexed position here
            occ = list.count(fldname)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Feb 2021 13:53:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030950#M60141</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-26T13:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030957#M60142</link>
      <description>&lt;P&gt;if that is what you got when clicking a link, then you some serious malware on your computer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;https:// quit spamming others&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;is the link from above&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 14:05:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1030957#M60142</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-26T14:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031050#M60144</link>
      <description>&lt;P&gt;So I guess where I'm still stuck is getting the count back into the new fields. I left the cursor2 block at the occ variable.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;infeature = r"C:\pathto\backup_02232021_TESTDELETE" #name of feature class goes here
fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"] 
for field_out in fields: #add new fields
    arcpy.AddField_management(infeature, "COUNT_"+field_out,"SHORT")
    
values_list= []
with arcpy.da.SearchCursor(infeature, fields) as cursor1:
    for row in cursor1:
        #access each field value by the index i then append
        for i in range(0,len(fields)):
            #you access a value by a row index, this starts at 0 from the
            #first field input - i.e. "name" field values are at row[0]
            values_list.append(row[i])

with arcpy.da.SearchCursor(infeature, fields) as cursor2:
    for row in cursor2:
        for i in range(0,len(fields)):
            #get the value of the field in the row
            value = row[i] 
            #count how often it appears in values_list
            occ = values_list.count(value)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how to use the below code you provided to update the new fields with the value count?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fields = ["name", "location_string_output", "email_address", "cell_phone_number", 
          "home_phone_number"]

#list to contain the new fields
new_fields = []
for field in fields:
     field_out = "COUNT_" + field
     #add the fields to all_fields
     new_fields.append(field_out)

#list to contain all fields, this is used as fields list
#in the update cursor - to do this we just add the lists together!
all_fields = fields + new_fields&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 17:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031050#M60144</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-26T17:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031079#M60146</link>
      <description>&lt;P&gt;I might in-fact be tempted to create a dictionary of values to the number of occurrences, then just map those across into the update cursor - rather than having to run .count() each time.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 18:41:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031079#M60146</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-26T18:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031138#M60149</link>
      <description>&lt;P&gt;Instead of trying to do the whole list of fields at once, how about iterating over each field and passing it into the cursors?&lt;/P&gt;&lt;P&gt;edited for refractoring the cursor into list comprehension and removing the r in the string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;excluded = ['OBJECTID', 'Shape', 'Shape_Length', 'Shape_Area'] # exclude fields if you want

# set the fieldnames
infeatureflds = [f.name for f in arcpy.ListFields(infeature) if f.name not in excluded]

for fld in infeatureflds:
    outfld = f"{fld}_cnts"
    arcpy.AddField_management(infeature, outfld, "SHORT")

    listValues = [row[0] for row in arcpy.da.SearchCursor(infeature, fld)]

    with arcpy.da.UpdateCursor(infeature, [fld, outfld]) as uCur:
        for row in uCur:
            row[1] = listValues.count(row[0])
            uCur.updateRow(row)

print("Done.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 22:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031138#M60149</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-26T22:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031142#M60150</link>
      <description>&lt;P&gt;Perfect idea.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 20:51:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031142#M60150</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-26T20:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031158#M60151</link>
      <description>&lt;P&gt;I'm at the mercy of you experts. I tried that and it worked flawlessly at first glance. I have a bunch of fields that don't need counted, so that excluded list is great.&lt;/P&gt;&lt;P&gt;Is this a type of f-string?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fr"{fld}_cnts"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm giving you guys all the credit for updating this little program. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 21:28:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031158#M60151</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-02-26T21:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: How To: Identify duplicate or unique values in ArcGIS Pro-- Update</title>
      <link>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031169#M60152</link>
      <description>&lt;P&gt;The 'f' is python 3 shorthand for .format().&amp;nbsp; I have a habit of always adding the 'r' in front of strings and it isn't necessary in this case.&lt;/P&gt;&lt;P&gt;Also, you can collapse that first searchcursor that is appending the values to the list to just:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;listValues = [row[0] for row in arcpy.da.SearchCursor(infeature, fld)]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 21:59:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-identify-duplicate-or-unique-values-in/m-p/1031169#M60152</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-26T21:59:39Z</dc:date>
    </item>
  </channel>
</rss>

