Hello guys
I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column (AREA_Ha) that is 3 decimal places long and would like to simply round it down to 2 decimals.
I have tried this ( round(!AREA_Ha!, 2))
but get this error message " There was a failure during processing, check the Geoprocessing Results window for details.
Your help please.
Solved! Go to Solution.
str(round(float(a.split(" ")[0]),2) ) + " ha"
but it is getting ridiculously convoluted, the area calculation should have been sent to a numeric field, rounding there, and then, converted to string in a subsequent field
that is because your area field was made into a string.
You can tell because it is left justified and contains 'ha' at the end. So however you created the area field wasn't a true area field but the representation of an area field.
The most descriptive is to follow
a = '1.2345 ha'
round(float(a.split(" ")[0]),2)
yields 1.23
where 'a' is your field name
Thanks Dan but is to possible to add the unit abbreviation eg.1.23 Ha
str(round(float(a.split(" ")[0]),2) ) + " ha"
but it is getting ridiculously convoluted, the area calculation should have been sent to a numeric field, rounding there, and then, converted to string in a subsequent field
Thanks Dan for your assistance