I am trying to use an UpdateCursor fill in a field but I keep getting an error, can anyone tell me what I am doing wrong? My code is below:
import arcpyfc= "C:\Users\Keri\Desktop\GEP_690\Project Data\FINAL_PROJECT.gdb\NYC_Demographics_2010"with arcpy.da.UpdateCursor(fc, ["Total1","White","Pct_White"]) as cursor: for field in cursor: if field[0]==0: field[2]=0 else: field[2] = field[1] / field[0] cursor.updateRow([field])print "Complete."del rowdel cursorThis is the error I keep getting:
Traceback (most recent call last): File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in __main__.__dict__ File "C:\GEP_662\Lab9.py", line 15, in cursor.updateRow([field])TypeError: sequence size must match size of the row
أكثر...
import arcpyfc= "C:\Users\Keri\Desktop\GEP_690\Project Data\FINAL_PROJECT.gdb\NYC_Demographics_2010"with arcpy.da.UpdateCursor(fc, ["Total1","White","Pct_White"]) as cursor: for field in cursor: if field[0]==0: field[2]=0 else: field[2] = field[1] / field[0] cursor.updateRow([field])print "Complete."del rowdel cursorThis is the error I keep getting:
Traceback (most recent call last): File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in __main__.__dict__ File "C:\GEP_662\Lab9.py", line 15, in cursor.updateRow([field])TypeError: sequence size must match size of the row
أكثر...