I want to replace the all the -9999 values in my attribute table with 0.
Does anyone know an easy way to do this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You can run this code inside the Python window. I assume that all those columns with
-9999 are of numeric type:
with arcpy.da.UpdateCursor('pure_proj', "*") as cur: for feat in cur: for i in range(len(feat)): if feat[i] == -9999: feat[i] = 0 cur.updateRow(feat)
What we are doing here:
Create a cursor connection to the underlying feature class using
As we got all the fields, we need to check every value in each row. This could be done using the
-9999 is found, we set the value for this particular row's column to be
0. Afterwards we update this particular row using the