3

I am using ArcMap 10.2 and I want to find duplicates in 2 columns.

For example, Street_Name, HSN and ID are my columns.

Street_Name:Pyxis--HSN:24--ID:2356

Street_Name:Pyxis--HSN:24--ID:4234

As you can see in example I want to find same HSN on Same street.

How can I do that? Any ideas?

0

3 Answers 3

5

If you have a Standard or Advanced license you can use tool Find Identical:

Reports any records in a feature class or table that have identical values in a list of fields, and generates a table listing these identical records.

If you only have basic license you can use python:

columns_to_check=['FIELDNAME','TEXT'] #change names and add/remove columns to compare

all_records=[i for i in arcpy.da.SearchCursor("polygons123",columns_to_check)]
columns_to_check.append('OBJECTID') #change field name to match your id field
with arcpy.da.SearchCursor("polygons123",columns_to_check) as cursor:
    for row in cursor:
        if all_records.count(row[:-1])>1:
            print 'ObjectID {0} is a duplicate'.format(row[-1])

Results:

ObjectID 1 is a duplicate
ObjectID 2 is a duplicate

enter image description here

3

I am not sure what licence you got but if you have only basic you can do it like that.

  1. Create new column "Duplicates" as string.
  2. Run calculate field on Duplicates with expression "HSN" + ' ' + "Street_Name" + ' ' + "ID"
  3. Right click on duplicates column and Summarise without anything.
  4. Join table to your shape file using Duplicates field.

So the idea is to create unique key for your data and after that just summarise it.

1
  • This is a great solution, much simpler than I had used before. Glad I found this post.
    – ed.hank
    Commented Sep 17, 2020 at 13:35
0

You can add a new column with Add field and use Field calculator (maybe with VB or Python code) to put value in it depending on the values of the two columns. (For example put 1 if the two values are the same or 0 if the two values are different.)

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