I'm having issues setting a row value to 0 when joining a csv to a shapefile. When the shapefile value is not in the csv, the row is getting set to 0 instead of null. This is a huge problem as i'm showing 0 change instead of no data. I tried row.setValue(field, None) and row.setNull(field) and both produce the same result. In the .dbf file of the shapefile, there is no value but in the UI attribute table a 0 is shown.
arcpy.AddField_management(shpfile, "TEST", "DOUBLE", field_is_nullable = 'NULLABLE') newcols = ["TEST"] with open(csvfile, 'rb') as csvfile: lib = dict() csvfile = csv.reader(csvfile, delimiter = ",") csvfile.next() #skip the headers for line in csvfile: lib[line[csvjoinindex]] = lib.get(line[csvjoinindex],line[csvstartfield:]) rows = arcpy.UpdateCursor(shpfile) for row in rows: shpjoinval = str(row.getValue(shapefilejoincol)) try: vals = lib.get(shpjoinval) for ind, field in enumerate(newcols): row.setValue(str(field),vals[ind]) rows.updateRow(row) except: for ind, field in enumerate(newcols): row.setNull(field) rows.updateRow(row)