AnsweredAssumed Answered

Replace empty attributes through 0

Question asked by JB1234510 on Nov 17, 2014
Latest reply on Nov 17, 2014 by Dan_Patterson
import arcpy  
import os  
  
in_data = r"R:\natura 2000\8847.04 MaP\7517-341_Horber_Neckarhaenge\Daten_Offenland\2014-11-12_PE_Maßnahmenentwurf\Reperatur\Reperatur.gdb\data\massnahmen_anm56_141117"  
  
field_list = []  
numeric_fields = ["Double", "Integer", "SmallInteger"]  
  
fields = arcpy.ListFields(in_data)  
for field in fields:  
    # if (field.type in numeric_fields):  
    field_list.append(field.name)  
  
# convert the list of fields to a semicolor delimited string  
fields = ";".join(field_list)    
  
rows = arcpy.UpdateCursor(in_data, '', '', fields)  
count = len(field_list)  
  
for row in rows:  
    for k in range(count):  
        if row.isNull(field_list[k]):  
            row.setValue(field_list[k], 0)  
        rows.updateRow(row)

 

This doesn't work? Why?

Outcomes