CÓMO

Eliminar y reemplazar caracteres de un campo de una tabla de atributos de ArcGIS Pro

Last Published: July 18, 2023

Resumen

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

Procedimiento

  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. de artículo: 000022616

Recibir notificaciones y encontrar soluciones a problemas nuevos o comunes

Obtenga respuestas resumidas y soluciones de vídeo de nuestro nuevo chatbot de IA.

Descargar la aplicación de soporte de Esri

Información relacionada

Descubrir más sobre este tema

Obtener ayuda de expertos en ArcGIS

Contactar con el soporte técnico

Descargar la aplicación de soporte de Esri

Ir a opciones de descarga