My python script calculates only the value of the immediate previous record instead of calculating the values of all preceding records before that particular record. The example (the image) below is the undesired output;
While the image below here is what i want to achieve;
This is my python script i used;
import arcpy from arcpy import da CensusBldForm = "CensusBldForm" Calculated_EA1=0 with arcpy.da.UpdateCursor(CensusBldForm, ["OBJECTID", "EstimatedPopulationinEA", "Calculated_EA"]) as cursor: for row in cursor: Calculated_EA2 = row[1] row[2] = (Calculated_EA1 + Calculated_EA2) Calculated_EA1 = Calculated_EA2 cursor.updateRow(row)
Kindly assist me with the above please.
Solved! Go to Solution.
Thanks