reclassify a field with field calculator using python problem

3514
3
09-21-2011 09:24 AM
ThomasJakubicka
New Contributor
Hello

I am trying to reclassify a column using the field calculator and python. i am basically using the script i found on the arcgis10 help page. when i am running the field calculator, everything goes fine and i get no error messages (see the script below).

the original column contains values between 0 and 1 and the type is double.

Now my problem is that the reclassification won't work. this means that every field in the new column is populated with "very low" instead of the matching classification. so the result is that i have a column where every field contains "very low"

i am still new to python and i hope anybody can help me with this
thanks a lot
thomas


def reclass(ICISS):
  if (ICISS >= 0 and ICISS <= 0,4):
    return "very low"
  elif (ICISS > 0,4 and ICISS <= 0,6):
    return "medium low"
  elif (ICISS > 0,6 and ICISS <= 0,8):
    return "medium high"
  else:
    return "very high"
Tags (2)
0 Kudos
3 Replies
DarrenWiens2
MVP Honored Contributor
I'm going to guess that this has to do with using a comma as the decimal point, and interpretting 0,4 as 4. Try replacing all of the commas with a period. Does your numerical column use commas?
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Is your Class field formatted with a ',' or a '.' for the decimal?  Try the following instead:

def reclass(ICISS):
  if (ICISS >= 0 and ICISS <= 0.4):
    return "very low"
  elif (ICISS > 0.4 and ICISS <= 0.6):
    return "medium low"
  elif (ICISS > 0.6 and ICISS <= 0.8):
    return "medium high"
  else:
    return "very high"
0 Kudos
ThomasJakubicka
New Contributor
great that worked.
thanks for the quick help
0 Kudos