This question already has an answer here:
I have an attribute table with a lot of lines.
I want to classify them considering their length:
- SHORT (from 0 to 50)
- MEDIUM (from 50 to 150)
- LONG (from 150 to 180)
How can I do avoiding to modify manually every 391 row?
This does not work:
Reclass(!Lenght!) Code Block: def Reclass(Lenght): if Lenght>= 0 and Lenght<= 30 return "Short" elif Lenght> 30 and Lenght<= 90): return "Medium" elif Lenght> 90 and Lenght<= 180): return "Long" elif Lenght> 30): return "VeryLong"
def lenght_cat(length,lenght_cat): if lenght> 0 and lenght< 14: return (length_cat*short) elif lenght> 14 and lenght< 20: return (length_cat*long) else: return None
but does not work unfortunately.