AnsweredAssumed Answered

Help debug this Python field calculator script

Question asked by michaellenorestormrecovery on Mar 17, 2017
Latest reply on Mar 17, 2017 by michaellenorestormrecovery

I can't get this to work. I want it to return "No Data" if the field PROP_CLASS is empty (see line 32). As things stand it returns "Other." It works otherwise. Any ideas? 

def CATEGORY(prop_class):
  if '200' <= prop_class <= '283':
    return "Residential"
  elif '310' <= prop_class <='312':
    return "Residential"
  elif prop_class == '322':
    return "Residential"
  elif '410' <= prop_class <= '413':
    return "Residential"
  elif prop_class == '416':
    return "Residential"
  elif prop_class == '693':
    return "Residential"
  elif prop_class == '300':
    return "Public/Vacant"
  elif  '313' <= prop_class <= '321':
    return "Public/Vacant"
  elif  '323' <= prop_class <= '380':
    return "Public/Vacant"
  elif prop_class == '531':
    return "Public/Vacant"
  elif prop_class == '552':
    return "Public/Vacant"
  elif prop_class == '560':
    return "Public/Vacant"
  elif '590' <= prop_class <= '593':
    return "Public/Vacant"
  elif prop_class == '695':
    return "Public/Vacant"
  elif  '900' <= prop_class <= '994':
    return "Public/Vacant"
  elif prop_class is None:
    return "No Data"
  else:
    return "Other"

Outcomes