I'm a Python beginner, I'm doing a risk analysis with a point feature, and I'm trying to write a script that allow me to update a field (proximity) based on different numeric values within different fields.
Each field (field_1
, field_2
, field_3
, field_4
) has just one possible value ( respectively 1
, 2
, 3
, 4
) and in each row there is recorded only one of these different values.
Example: If in a row there's 1
in field_1
it's impossible to find other values in the other fields.
I would like to put everything in one field (proximity) to indicate the risk level.
I tried to run the following script to test only with field_1
, but it's not updating, it's just printing "Nothing for each row"
.
with arcpy.da.UpdateCursor("point", "proximity") as cursor:
for row in cursor:
with arcpy.da.SearchCursor("point", "field_1") as scursor:
for row in scursor:
if row[0] == 1:
cursor.updateRow(row)
else:
print ("Nothing")