操作方法

操作方法:使用“字段计算器”(Python) 工具替换属性表中多个字段中的文本

Last Published: November 1, 2023

摘要

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.

过程

  1. In ArcGIS Pro, open the attribute table of the layer.
Screenshot of the feature layer to open the attribute table
  1. In the attribute table, right-click the field heading, and click Calculate Field.
Image of 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.
Image of 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.
 
Image of the example of the text being replaced in the attribute table

文章 ID:000025171

接收通知并查找新问题或常见问题的解决方案

从我们全新的 AI 聊天机器人中获得简明答案和视频解决方案。

下载 Esri 支持应用程序

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项