HOW TO

Remove leading zeros in an attribute table in ArcGIS Pro

First Published: July 6, 2023
Last Published: July 2, 2026

Summary

Removing leading zeros from a field in an attribute table can be time-consuming if the data provided is large. However, this task can be automated using a Python or Arcade expression. In Python, the Int() function is used to remove the leading zeros from a text data type field, deeming the values as integers, thus preventing the population of numbers beginning with a zero ('0'). This article provides the workflow to automate the removal of leading zeros from a field in an attribute table, as shown below, using a Python or Arcade expression in ArcGIS Pro.

The data with leading zeros under the Distance field in an attribute table.

Procedure

  1. Open the ArcGIS Pro project.
  2. In the Contents pane, right-click the layer and click Attribute Table.
  3. In the attribute table, right-click the field’s header and select Calculate Field. In this example, Distance (KM) is used.
  4. In the Calculate Field window, select Python or Arcade from the Expression Type drop-down list.
The Calculate Field window
  • For Python, in the <Field_Name> box, type the expression below and click Verify.
Int(!<Field_Name>!)
The Python expression configured in the expression box.
  • For Arcade, in the <Field_Name> box, type the expression below and click Verify.
Number($feature.<Field_Name>)
The Arcade expression configured in the expression box.
  1. When the message "Expression is valid" is returned, click OK.
The Expression is valid message is returned.

The following attribute table shows the leading zeros removed from the data.

The leading zeros removed from the data in the attribute table.

Article ID: 000030731

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