3

I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value less than the value of improvements, (2)Land value about the same value as improvements, (3) Land value more than improvement value, but less than twice the value, and (4) Land value which is more than twice improvement value.

I wrote the following script, and it runs successfully in Field Calculator (doesn't give any errors), but it only returns 4, which is clearly not the case in the data.

LV = " !LAND_VAL! "
IV = " !IMPRVT_VAL! "
def Recode(Val_Analys):
 if LV < IV:
 return 1
 elif LV == IV:
 return 2
 elif (LV > IV and LV < (IV * 2)):
 return 3
 elif LV > (IV * 2) :
 return 4
 else:
 return 0
Recode(!Val_Analys!)
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Apr 9, 2014 at 22:50

1 Answer 1

7

Just put this as the script code:

def Recode(LV, IV):
 if LV < IV:
 return 1
 elif LV == IV:
 return 2
 elif (LV > IV and LV < (IV * 2)):
 return 3
 elif LV > (IV * 2) :
 return 4
 else:
 return 0
Recode(!LAND_VAL!, !IMPRVT_VAL!)
answered Apr 9, 2014 at 23:06
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.