HOW TO

Replace text in multiple fields in an attribute table using Field Calculator (Python)

Last Published: November 1, 2023

Summary

An attribute table is a database containing non-spatial information on a set of geographic features in a geographic information system (GIS). The information is arranged so each row represents a featureĀ and each column represents one feature attribute. In ArcGIS Pro, rows are known as records and columns are fields. Each field stores specific types of data, such as numbers, dates, or text.

The instructions provided describe how to use the Replace function in the Field Calculator (Python) tool to replace text in multiple fields within an attribute table without editing each record individually.

Procedure

  1. In ArcGIS Pro, open the attribute table of the layer.
The feature layer to open the attribute table
  1. In the attribute table, right-click the field heading, and click Calculate Field.
Selecting the Calculate Field option
  1. In the Calculate Field window, select the feature layer for Input Table, the field name for Field Name (Existing or New), and Python 3 for Expression Type.
  2. Double-click the field name under Fields, and .replace() under Helpers.
  3. In the expression box, type the value to be replaced, and the replacement value. Enclose each value in quotation marks, and separate them with a comma.
The inputs in the Calculate field dialog box
  1. Click Apply and click OK.

The following image shows the text replaced in the attribute table.

An example of the text being replaced in the attribute table

Article ID:000025171

Software:
  • ArcGIS Pro 2 x
  • ArcGIS Pro 2 7 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options