I'm looking for a python script using ArcPy that can convert all values in a shapefile's attribute table to a value of 0 as I will then populate with other values from another source.
I have reviewed Converting case of all values in all fields of table using ArcPy & Python? and Replacing NULL value with Zero in geodatabase table using Python parser of ArcGIS field calculator? but to no avail as they don't account for other possible numerical values. Here is a snippet of the attribute table.
Also, I have no null values in any of the attribute tables. This is how far I was able to go.
import arcpy
fc = r'path'
desc = arcpy.Describe(fc)
fields = desc.fields
for field in fields:
if field.Type == "Number":
with arcpy.da.UpdateCursor(fc, str(field.name)) as cursor:
for row in cursor:
if x is None or Not 0:
return 0
else:
return ?
