ArcGIS Pro 2.8.4: The Python If statement fails to work,
In the screenshot below, I wanted to apply a simple if statement but fails to work and ends up with an error
-----
def Reclass(Confinement):
if Confinement == Confined:
return 1500
return 0
-----
What could be the issue here?
The data is attached
Solved! Go to Solution.
Code Block:
def Reclass(Confinement):
if Confinement == 'Confined':
return 1500
else:
return 0
Confinement == "Confined"
and it should be, with a python parser
Reclass(!Confinement!)
to invoke it. Note the enclosing ! marks
Code Block:
def Reclass(Confinement):
if Confinement == 'Confined':
return 1500
else:
return 0
Thank you JayantaPoddar for the help. It works fine
------
def Reclass(Confinement):
if Confinement == 'Confined':
return 1500
else:
return 0
--------