4

I am using ArcGIS Pro 1.4.0. My current problem is that all new numeric values (float and double) are being rounded into whole numbers in the attribute table of shapefiles. According to this ArcGIS Desktop help site Formatting numeric fields in tables ,

"six is the default number of decimal places to display in the Table window."

However, this does not seem to be the case for my version of ArcGIS. For example, see below image. First, I calculated the geometry of gridcells in my shapefile (POLY_AREA). Next, I created a new field and calculated it to equal POLY_AREA. As displayed, all numbers are rounded to the whole number. I've included the python window in the clipped image for reference. Also, I am not sure what version of ArcMAP the original shapefiles were created in, but definitely pre-ArcGIS pro. The issue continues to occur even after exporting/copying them several times within pro.

enter image description here

In this instance, the rounding is not a problem; however, moving forward I will be conducting calculations on many small decimals. I know how to manually change the display, but it is very tedious to do tens or hundreds of times.

Is this a bug, or does anyone know how to globally change the default display of numeric values?

  • I've noticed that you sometimes have to make the changes described by @Midavalo, save the project, close ArcGIS Pro, and reopen it to apply changes for decimal length. – Map Man Feb 16 '17 at 19:25
  • Did you use Pro to add the field to a feature class or did it come from some other software? Feature class or shapefile? Normally Pro displays to 6 decimal places by default for any float or double precision field added by Pro or ArcMap 10.4 or 10.5 to any layer. The only way to display fewer by default is to add the field to a shapefile in ArcMap 10.3 or earlier or via QGIS, and setting a precision there. Pro seems to respect that setting. – johns Feb 16 '17 at 21:29
  • Thank you. I've updated my description with an image of the attribute table, as well as description of my steps. I am trying to add fields to shapefiles within pro, however, the original shapefiles were created in a previous version of ArcMap (not pro) and by another user. – ellejay Feb 16 '17 at 23:36
1

Your problem appears to be related to the Precision and Scale of your new FLOAT field. Try making the Precision 6 and the Scale a larger number, e.g.

arcpy.management.AddField('JanVars', "sqkm0", "FLOAT", 6, 10)
arcpy.management.CalculateField('JanVars', 'sqkm0', "!POLY_AREA!", "PYTHON_9.3", None)

In my testing I created and calculated three FLOAT type fields, and then calculated them all based on an Area field. I created and calculated based on the arcpy you included in your question.

arcpy.management.AddField('mypolygon', "float1", "FLOAT", 6, 4)
arcpy.management.CalculateField('mypolygon', 'float1', "!AREA!", "PYTHON_9.3", None)
arcpy.management.AddField('mypolygon', "float2", "FLOAT", 4, 4)
arcpy.management.CalculateField('mypolygon', 'float2', "!AREA!", "PYTHON_9.3", None)
arcpy.management.AddField('mypolygon', "float3", "FLOAT", 6, 10)
arcpy.management.CalculateField('mypolygon', 'float3', "!AREA!", "PYTHON_9.3", None)

enter image description here

As you can see in the attribute table, only the last field float3 stored the values with their decimal places. The other fields rounded the values.

enter image description here

Precision is supposed to be the total number of digits you can store in a field, and Scale the number of decimal digits allowed, however in this case it seems to be reversed? Someone who understands FLOAT better may be able to add more info.

Test was on ArcGIS Pro 1.4.1, mypolygon was a shapefile created in ArcMap 10.5.

  • Your suggestion to flip the scale and precision is right on target, and will serve as a great solution for now. However, I am similarly confused as to why? I also did some tests and found that a float var with precision=6 & scale=10 resulted in 6 total digits w/2 decimal places, but the same precision and scale for a double field type resulted in 10 total digits and 6 decimal places. – ellejay Feb 17 '17 at 2:22
4

In my ArcGIS Pro it doesn't appear to have any option to set default decimal places, but it does appear to round to 6 decimal places, the same as ArcGIS Desktop.

For example, here I have entered the number 123.12345678901234567890, which it has rounded for storing to 123.12345678901235, and is rounding for display to 123.123457

enter image description here

You can modify the numeric display settings for specific fields in the Attribute Table. (Note that I had to first set my displayed decimal places to 0 in order to produce these examples. It was showing the correct decimal places as default for me).

Click on the column header and select Field

enter image description here

You will see there's a place to set the Number Format. Click on the ellipsis ... here and it will open the Number Format options

enter image description here

You can now set your displayed decimal places

enter image description here

You will note it says

General options for the display of numbers

so it does not change what is stored in the database, just how it is displayed in the attribute table or info window in ArcGIS Pro.

enter image description here

  • True, the display is not actually rounding the number, thankfully. After manually changing the display from 0 --> 6 decimals, I can see the complete number. The issue is that my default display seems to be zero...not 6. What version are you using, and what type of table did you test? – ellejay Feb 16 '17 at 23:38
  • I'm using ArcGIS Pro 1.4.1, and my data was a file geodatabase point feature class. – Midavalo Feb 16 '17 at 23:56
  • Thanks @Midavalo. That ellipsis on the Numeric field is hidden very deep. You should be able to right click on the field and change the properties of format. Not sure why it has to buried in such an obscure place. – Mattropolis Jan 24 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.