@SSISC_FieldCrew, to start, I would recommend updating a new field, at least until you're sure you have the logic the way you want.
To follow along with what Dan showed, I tried the following:
Expression:
plant(!INV_SP_PLA!)
Code Block:
plant_dictionary = {
"ABUT THE": "Velvet leaf",
"ACRO REP": "Russian knapweed",
"AEGI CYL": "Jointed goatgrass",
"AEGO POD": "Goutweed / bishop's weed",
"AILA ALT": "Tree of heaven",
"ALHA MAU": "Camel thorn",
"ALLI PET": "Garlic mustard"
}
def plant(val):
"""Demo"""
if val in plant_dictionary.keys():
new_val = plant_dictionary[val]
return new_val
else:
return val
Given the below table, the updated values are shown in the `new` field:
I included an `else` condition to return the original value if it's not in the dictionary. Like Joshua mentioned, variations in the original field values would result in some values not being updated.