I have a field called "CODE_12" in which the values are strings (3 characters). I have another empty field called "AE" and that I want to fill depending on the value on the "CODE_12" field. For example, when the CODE_12 field is equal to 112 I want the AE field to have a value of 396. I have tried using the UpdateCursor but I'm getting the error "Invalid input value for setting". Any idea of what I´m doing wrong? I attache my code
rows = arcpy.UpdateCursor(RainLandUnion) # This is my feature layer
for row in rows:
if row.getValue("CODE_12") == "112":
row.setValue("AE", 396.71)
elif row.getValue("CODE_12") == "221":
row.setValue("AE",435.920)
elif row.getValue("CODE_12") == "321":
row.setValue=("AE", 438.2)
elif row.getValue("CODE_12") == "242":
row.setValue= ("AE",425.45)
elif row.getValue("CODE_12") == "243":
row.setValue= ("AE",425.45)
elif row.getValue("CODE_12") == "324":
row.setValue=("AE",441.64)
elif row.getValue("CODE_12") == "313":
row.setValue= ("AE",441.64)
rows.updateRow(row)
The full error message is :
Message File Name Line Position Traceback
C:\Users\Administrator\Desktop\Nuenna\nuenna shapes\model_sample\ae_calc.py 51
setattr C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects_base.py 35
exceptions.ValueError: Row: Invalid input value for setting
row.setValue("AE",str(441.64))