In some cases, you may want to calculate a field based on the value of another field. A good example of this would be when you may want to create or calculate domain code values from a description field.
In the following example we are using some Tree data to calculate the Risk_Code associated with the Risk description which can then later be used as a Domain.
- To begin, open the Attribute Table for the data in ArcGIS Pro

- Select applicable field to calculate (i.e. RISK_CODE)
- Right click field (RISK_CODE) > Field Calculator

- Select Python 3 as the Expression Type
Code Block
def calcRiskCode(riskDesc):
if riskDesc == "High":
return 1
elif riskDesc == "Medium":
return 2
elif riskDesc == "Low":
return 3
else:
return 0
Expression:
calcRiskCode(!RISK_DESC!)
- Click OK.
For example:
Result:


Further Calculate Field Examples:
https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field-examples.htm
Sam Pienaar.