laptop and a wrench

Error

In ArcGIS Pro, calculating the field values with the 'is' operator does not work if the corresponding value has spaces or special characters.

Última publicación: July 8, 2021 ArcGIS Pro
Número de ID del error BUG-000140734
EnviadoJune 15, 2021
Última modificaciónMarch 20, 2025
Relacionado conArcGIS Pro
Versión encontrada2.8
Sistema operativoWindows OS
Versión de sistema operativo10.0 64 Bit
EstadoWill Not Be Addressed

Información adicional

This is a quirk of the is the operator in Python (which checks whether two objects point to the same memory), and how strings are stored (equivalent alphanumeric strings like 'Texas' point to the same object in memory when invoked, strings such as 'South Dakota' do not point to the same object in memory. The top answer at https://stackoverflow.com/questions/16756699/is-operator-behaves-differently-when-comparing-strings-with-spaces describes this well). String equality has to be checked using == (which checks for value equality) for this reason.

Solución alternativa

It is to be noted other operators can be used in the scenario to return the results when matching them up with the fields having values of either spaces or some other special characters. 

Expression 1: 

def Reclass(value1): 

  if value1 == 'South Dakota': 

    return 1 

  else: 

    return 0 

Expression 2: 

def Reclass(value1): 

  if 'South Dakota' in value1: 

    return 1 

  else: 

    return 0 

Pasos para reproducir

ID del error: BUG-000140734

Software:

  • ArcGIS Pro

Recibir notificaciones cuando cambie el estado de un error

Descargar la aplicación de soporte de Esri

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