I have a table in a file geodatabase that has "FieldA" and "FieldB".
I want to update FieldB with one of two values, depending on if there are one or more records with the same value of FieldA.
FieldA FieldB 1 0 2 1 2 1 3 0
I've tried this way
with arcpy.da.UpdateCursor(featureClass, ("FieldA", "FieldB")) as cursor: for rupd in cursor: rows = [row for row in arcpy.SearchCursor(featureClass, 'FieldA=' + str(rupd) )] if len(rows)>1: rupd=0 else: rupd=1 cursor.updateRow(rupd)
The table has around 100k records. It takes around 1 second each record.
Can this performance be improved?