I am trying to identify duplicate records between two feature classes in a file gdb (Arc 10.3). I first create a set of unique IDs present in FC_1, then use an if statement to identify whether the IDs in FC_2 are present in FC_1.
checkfield = "gisID"
unique_values = set(row[0] for row in arcpy.da.SearchCursor(FC_1, checkfield))
with arcpy.da.UpdateCursor (FC_2, [checkfield, "Type"]) as uCurs:
for uRow in uCurs:
print (uRow[0])
if uRow [0] in unique_values:
uRow [1] = "duplicate"
uCurs.updateRow(uRow)
else:
uRow [1] = "unique"
uCurs.updateRow(uRow)
# check if uRow[0] is in the set
if 200683 in unique_values:
print ("200683 is in the set")
I've purposefully set up the feature classes such that the 2 records in FC_2 have IDs already present in FC_1. The last 3 lines in the script are there to check this.
However, FC_2 "Type" field only updates with "unique", when these are clearly duplicates. Any advice on how to correct this?