AnsweredAssumed Answered

Loop through Columns and Rows

Question asked by rgthurau on Apr 19, 2012
Latest reply on Apr 19, 2012 by rgthurau
Hi,
I am trying to use an update cursor to loop through all fields and all rows and replace 0 with 9999. I've looked up a column command that appears to work for some people, but is not going well for me.
Here's the code:

import arcpy, os from arcpy.sa import * from arcpy import env arcpy.CheckOutExtension("Spatial") arcpy.env.overwriteOutput = True  areaTab1 = r"X:\DATA\ROW_SP_areaTab"  rows = arcpy.UpdateCursor(areaTab1) for row in rows:     for col in rows:         if row.getValue(row) == 0:             row.setValue(9999)             row.updateRow(row)


Error:
Traceback (most recent call last):
  File "C:\_Rich\Project_Temp\col_loop_test.py", line 13, in <module>
    if row.getValue(row) == 0:
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\arcobjects.py", line 945, in getValue
    return convertArcObjectToPythonObject(self._arc_object.GetValue(*gp_fixargs(args)))
RuntimeError: ERROR 999999: Error executing function.

This would be awesome and incredibly useful to be able to run instead of having to search each individual field.

Any help would be greatly appreciated!!

Thanks

Rich

Outcomes