HOW TO

Set the display format of numeric fields in a layer using ArcPy in ArcGIS Pro

First Published: July 15, 2026
Last Published: July 15, 2026

Summary

In ArcGIS Pro, the display format of a numeric field in a layer can be manually configured in the fields view. However, this method applies only to a field or layer at a time.

Alternatively, ArcPy can be used to programmatically control the display format of numeric fields across multiple fields or layers by using the Cartographic Information Model (CIM) while retaining the original data values or field type. The CIM is a structured representation of layer properties that provides access to field display settings unavailable through standard ArcPy functionality.

This article describes the workflow to set the display format of numeric fields with double and float data types in a layer using ArcPy in ArcGIS Pro. In this example, a decimal format is changed to a whole number.

The pop-up for the point layer before conversion to a whole number

Procedure

  1. Open the project in ArcGIS Pro.
  2. On the View tab, in the Windows group, click Python Window.
  3. In the Python window, copy and paste the code below to set the numeric field display format in ArcGIS Pro.
Note:
Avoid pressing Enter between lines, as it creates indentation errors. The full script must be run at once.
  1. Import the ArcPy library.
import arcpy
  1. Retrieve the current project and map.
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps()[0]
  1. Retrieve the layer CIM definition and define the target numeric fields for formatting.
lyr = m.listLayers('<Layer_Name>')[0]   #Replace <Layer_Name> to the layer name
lyr_cim = lyr.getDefinition('V3')
fList = ["<Field_Name1>", "<Field_Name2>"]  #Replace <Field_Name1> and <Field_Name2> with the field names
  1. Check whether the layer contains any field description entries within the CIM.
if len(lyr_cim.featureTable.fieldDescriptions) == 0:
    print('No CIM Field Info')
  1. Create a temporary feature layer and retrieve the CIM definition.
mkLyr = arcpy.management.MakeFeatureLayer(lyr)[0]
mkLyr_cim = mkLyr.getDefinition('V3')
  1. Loop through the target fields and set numeric formatting properties.
for fd in mkLyr_cim.featureTable.fieldDescriptions:
    if fd.fieldName in fList:
fd.numberFormat.roundingOption = "esriRoundNumberOfDecimals"
fd.numberFormat.roundingValue = 0 fd.numberFormat.zeroPad = True
  1. Copy the modified field description settings from the temporary layer and apply them to the original layer.
mkLyr.setDefinition(mkLyr_cim)

lyr_cim.featureTable.fieldDescriptions = mkLyr_cim.featureTable.fieldDescriptions lyr.setDefinition(lyr_cim) m.removeLayer(mkLyr)

The code below shows the complete script.

import arcpy

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps()[0]

lyr = m.listLayers('TestingNumeric_Point')[0]
lyr_cim = lyr.getDefinition('V3')
fList = ["VALUE1", "VALUE2"]

if len(lyr_cim.featureTable.fieldDescriptions) == 0:
    print('No CIM Field Info')
    
mkLyr = arcpy.management.MakeFeatureLayer(lyr)[0]
mkLyr_cim = mkLyr.getDefinition('V3')
    
for fd in mkLyr_cim.featureTable.fieldDescriptions:
    if fd.fieldName in fList:
        fd.numberFormat.roundingOption = "esriRoundNumberOfDecimals"
        fd.numberFormat.roundingValue = 0
        fd.numberFormat.zeroPad = True         
    
mkLyr.setDefinition(mkLyr_cim)
    
lyr_cim.featureTable.fieldDescriptions = mkLyr_cim.featureTable.fieldDescriptions  
lyr.setDefinition(lyr_cim)
m.removeLayer(mkLyr)
  1. Press Enter twice to run the code.

The pop-up below displays the formatted numeric field values converted from decimals to whole numbers.

The pop-up for the point layer

Article ID: 000042314

Software:
  • ArcGIS Pro

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options