I was hoping someone could help me with an issue I've been having while trying to aggregate data into a new column in an attribute table in arcgis. This is part of a model built using model builder. I added a new column, but the model always fails when it reaches the part where it has to populate the new column.
I'm trying to group specific land uses into a new land type (for example: field, pasture, and crop should all be coded as 'Agriculture' in the new column). I have been using the field calculator tool to populate the new column, but it's not working. I think either field calculator is the wrong tool to use in this scenario, or my python is wrong. Any advice? My python is below.
def landuse_groupFromName(LUDCODE):
if LUDCODE in ['23', '1', '36', '35', '2']:
return 'Agriculture'
elif LUDCODE in ['15', '16', '5']:
return 'Commercial/Industry'
elif LUDCODE in ['11', '10']:
return 'High_Density_Res'
elif LUDCODE in ['13', '38']:
return 'Low_Density_Res'
elif LUDCODE in ['12']:
return 'Med_Density_Res'
elif LUDCODE in ['34', '26', '29', '7', '8', '17', '9']:
return 'Recreation'
elif LUDCODE in ['18']:
return 'Transportation'
elif LUDCODE in ['31']:
return 'Urban'
elif LUDCODE in ['39', '19']:
return 'Waste'
elif LUDCODE in ['20']:
return 'Water'
elif LUDCODE in ['37', '14']:
return 'Wetlands'
elif LUDCODE in ['40', '3', '4', '6', '24', '25']:
return 'Wild'
else:
return 'undefined'
elif LUDCODE in ['15', '16', '5']:
rather beelif LUDCODE in [15, 16, 5]:
?