Select to view content in your preferred language

Field Calculator isn't working, I cannot figure out why

287
1
12-01-2024 03:02 PM
AdrienneGreve
New Contributor

I am trying to define a field in a Polygon attribute table (UHI2020) using data from another field, ppkm2. The python box reads as follows: 

def reclass(UHI2020):
if (ppkm2 <= 100):
return 1
elif (ppkm2 > 100 and ppkm2 <= 2700):
return 2
elif (X1 > 2700):
return 3

What have I done wrong? I run it and the content of UHI2020 does not change.

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor
reclass(!UHI2020!)  # expression with python parser note ! mars

def reclass(ppkm2):
    if (ppkm2 <= 100):
        return 1
    elif (ppkm2 > 100 and ppkm2 <= 2700):
        return 2
    elif (ppkm2 > 2700):
        return 3

try the expression and the code box in the above


... sort of retired...