Hello,
I am super new to ArcGIS so please don't judge me too harshly for what seems like an easy question that I can't get to work. I also apologize for being really bad at explaining things
I need to change specific values in a field into another value. So the field I have is Environmental Setting, which has contingent values of <Null>, Hammock, Pasture, etc. Presently, someone ran a script which changed all the values and I have the amazing job of changing them back manually. I've tried the find and replace tool, as well as calculate tool for .replace() and have failed. If I need to change all values of Hammock into Pasture, how would I do that?
First, you will want to select by attribute. You can do this from the main ribbon at the top of ArcPro, or from the attribute table. Here's an example:
Then right click the column and select Field Calculator:
Then simply type 'Pasture' and all of only the selected records will change. Be aware though, this will change all of the Hammock into Pasture, even the ones that were Hammock before that previous change.
Probably Field Calculate in the same way the values were originally changed. Be aware this modifies the source data so try on a local copy first, and always keep a backup for some time.
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field.htm
Ensure you past the the 'Code Block' at the bottom of the Field Calculator window.
then above the Code Block you will have something that looks like <fieldname being calculated> =
in the box below that enter (obviously replace with your fieldname):
Reclass(!Environmental Setting! )
Expression:
Reclass(!Environmental Setting!)
Code Block:
def Reclass(field):
if field == 'Hammock':
return 'Pasture'
elif field == 'Elephant':
return 'Grass'
elif field == 'Rhino':
return 'Arable'
else:
return field