AnsweredAssumed Answered

UpdateCursor to update a field value

Question asked by CCweedcontrol on Sep 29, 2016
Latest reply on Sep 29, 2016 by CCweedcontrol

I have a basic UpdateCursor to update a field value but for some reason the row with "5280" won't update to "1". It only updates the "10560" to "2".

it's probably something i am over looking but not sure what's going on. Any help would be great.

 

arcpy.Buffer_analysis(SP, outfile, distance, "OUTSIDE_ONLY", "ROUND", "", "BUFF_DIST")

arcpy.Merge_management(["wp2 Mile","wp1 Mile"], "1_2")

with arcpy.da.UpdateCursor("1_2" , "BUFF_DIST") as cursor:
            for row in cursor:
                if row[0] == 5280:
                    row[0] = '1'
                elif row[0] == 10560:
                    row[0] = '2'
                    cursor.updateRow(row)
            del row

I have tried  else: but i get the same results.

with arcpy.da.UpdateCursor("1_2" , "BUFF_DIST") as cursor:
            for row in cursor:
                if row[0] == 5280:
                    row[0] = '1'
                else:
                    row[0] = '2'
                    cursor.updateRow(row)
            del row

Outcomes