Reclass Field Calculator problem

996
4
Jump to solution
08-10-2017 02:49 AM
MartaPo
New Contributor

Hi,

I am having a massive problem with running this script in ArcGIS 10.3 Field Calculator Python

def Reclass(CLASS):
 if CLASS=="2":
  return "2a"
 elif CLASS=="3"
  return "3a"
 else:
  return (CLASS)

Any help much appreciated.

Thank you,

Marta

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Try this:

def Reclass(CLASS):
  if CLASS=="2":
    return "2a"
  elif CLASS=="3":
    return "3a"
  else:
    return CLASS

View solution in original post

4 Replies
XanderBakker
Esri Esteemed Contributor

Try this:

def Reclass(CLASS):
  if CLASS=="2":
    return "2a"
  elif CLASS=="3":
    return "3a"
  else:
    return CLASS
MartaPo
New Contributor

Hi Xander,

It is working now. I have not realised that the spacing is so important. Thank you

0 Kudos
XanderBakker
Esri Esteemed Contributor

You are welcome, glad it works

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

If Xander's suggestion doesn't work, it would be helpful if you explain what exactly isn't working, including posting the error message(s).

0 Kudos