New answers tagged


As others point out, you can't use 'or' like that, since a string will almost always be True. What you likely want is something like this: Notice the initialysation of var, so it don't carry any old value, in case non of the criteria are fullfilled. def reclass(siteclass, tempzone, rainzone): val = 'Undefined...' if 'ST' in siteclass: # and if '...


You are close. I believe you just need to return your desired text string. And make sure argument names match your variable names (if mean temperature and temperature are different columns, be sure to include them as separate arguments) def Reclass(temperature, altitude, precipitation): if temperature >= 18 and altitude < 650 and precipitation >=...


The syntax should be: def wType(SWPULP, HWPULP): if SWPULP>=75: return "SP" elif HWPULP>=75: return "HP" else: return "MW" Call with: wType(!SWPULP!, !HWPULP!)


Use None not NULL. Python doesn't understand "NULL" Your if else is not valid python syntax, you need if: and else: with indented lines below each You don't need to add literal strings to literal strings "<UND><BOL>" not "<UND>"+"<BOL>" String formatting is faster than concatenating (adding) ...

Top 50 recent answers are included