I am struggling to calculate the acreage as a percentage in Calculate Field Management, but I am getting this error message:
"ValueError: could not convert string to float! BufferAcreage!
arcpy.CalculateField_management(fc, "BuffAcreage", "!shape.area@acres!", "PYTHON", "") arcpy.CalculateField_management(fc, "BuffPct", float("!BufferAcreage!")/float("!Acres_Whole!") * 100, "PYTHON", "")
The initial line of code works perfectly, but it is the second line of code when I am calculating the acreage percentage that I run into the error.
It will not calculate the field because for some reason it is telling me that I am treating the values in these attributes as strings and will not convert them to floats.
It must be done with the
arcpy.CalculateField_management(). I can not use an alternative python scripting method because the assignment directions stipulated that I must use the Calculate Field tool in my script. Any suggestions?