HOW TO
In ArcGIS Pro, certain characters can be excluded from a field value in a label to improve map clarity, making the map easier to read and interpret. The split() function is typically used for this type of operation. However, in this case, zone codes are used, and there is no consistent naming convention, making this function unsuitable for the scenario.
This article provides the workflow to label features by excluding specific characters using a Python expression in ArcGIS Pro. The image below displays the field values used in this example.
Note: In the Contents pane, on the List By Labeling tab, ensure the selected feature layer and feature class check boxes are checked to display the labels.
def FindLabel([<field_name>]): return [<field_name>].translate({ord(i): None for i in '<value>'})
Note: The <value> placeholder must include all characters to remove from the field values when labeling. In this example, to filter out all alphabetic characters (both uppercase and lowercase) and hyphens (-), replace with 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'. This ensures that only numbers remain in the label.
The image below displays the map without numbers on the label.
Get help from ArcGIS experts
Download the Esri Support App