操作方法

操作方法:从 ArcGIS Pro 属性表的字段中移除和替换字符

Last Published: July 18, 2023

摘要

The instructions provided describe how to remove and replace characters from a field in an attribute table using the Calculate Field tool in ArcGIS Pro. In this example, the hyphens (-) are removed under the Region field of the attribute table, and replaced with a comma (,) for improved readability.

An attribute table with hyphens in the Region field

过程

  1. Open the project in ArcGIS Pro.
  2. Right-click the layer in the Contents pane, and click Attribute Table.
  3. Click the Calculate Field button The Calculate Field button to open the Calculate Field geoprocessing tool.
  4. In the Calculate Field pane, select the field for editing under Field Name (Existing or New). In this example, it is Region. Ensure the Expression Type is Python3.
  5. Under the Expression section, click the field for editing (in this example, it is Region) from the Fields list. Click .replace() from the Helpers list.
  6. Within the bracket in .replace(), type "-","," to replace the hyphens with a comma, as shown below.
 ![FieldName]!.replace("-",", ")

The following demonstrates the proper expression:

 !Region!.replace("-",", ")
  1. Click OK. The tool completes with the hyphens removed and replaced with a comma.
The Calculate Field tool window is to be configured.
  1. Click the Save Edits button The Save Edits button in the Calculate Field pane to save the changes.
The attribute table with the hyphens replaced with commas

文章 ID: 000022616

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

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

下载 Esri 支持应用程序

相关信息

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项