This code is meant to apply an update cursor to a field called "New_Sq_Mile" when I am populating the field with the area of the polygons. Unfortunately the units are in meters and I need to do a calculation to change those values to miles before they are updated into the table. Here is what I have so far.

cursor = arcpy.UpdateCursor(FinalErase, ["SHAPE@AREA", "New_Sq_Mile"])

for row in cursor:
    row[1] = row[0]

del row
del cursor

Is there a way I can do a calculation in the for loop such as

row[1] = row[0]/1606.344
  • Btw: 1 square meter is not 1/1606,344 square mile
    – BERA
    May 2, 2017 at 19:27

1 Answer 1


You should use the newer Data Access module Cursors, for example da.UpdateCursor. They are alot faster. In your case like this:

import arcpy
with arcpy.da.UpdateCursor(FinalErase,["SHAPE@AREA","New_Sq_Mile"]) as cursor:
    for row in cursor:
  • 1
    It worked! Thank you. I am a student and did not realize there was a difference between cursors and data access module cursors.
    – Noah P
    May 2, 2017 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.