I want to write Python code that removes duplicate features from a table based on their attribute value. Within the code, a loop will iterate through multiple attributes to check if the value is Null. If the attribute is not null, it is assigned to a "keep list." If the attribute is null, it is assigned to a "delete list."
How can I compare multiple values (Null and not Null) within the same attribute?
(row[0]a and row[0]b)
import arcpy
fc = "F:/path/"
drTable = "F:/path/"
workspace = "F:/path/"
def main():
arcpy.MakeFeatureLayer_management(fc, "fc_lyr")
arcpy.JoinField_management("fc_lyr", "OBJECTID", drTable, "OBJECTID", "KEEP_COMMON")
deleteList = []
keepList = []
with arcpy.da.SearchCursor("fc_lyr", ['OBJECTID']) as cursor:
for row in cursor:
arcpy.SelectByLocation_management("fc_lyr", "ARE IDENTICAL TO", "fc_lyr",
"NEW_SELECTION")
if arcpy.GetCount_management("fc_lyr") >= 2:
with arcpy.da.SearchCursor("fc_lyr", ['attr1','attr2','attr3',]) as cursor:
for row in cursor:
if row[0] is None and row[0] is None:
#???
elif row[0] is None and row[0] is not None:
deleteList.append(row[0])
elif row[0] is not None and row[0] is None:
deleteList.append(row[0])
elif row[0] is not None and row[0] is not None:
#???
None somethingelse
?