Hello, I want write a python code block using " geoprocessing calculate field that adds a text field to the roads.shp feature class called FERRY. This new field should be populated with values of YES and NO depending on the value of the FEATURE field. If the value of the FEATURE field is ‘Ferry Crossing’, the value of the FERRY field should be YES – otherwise the value of theFERRY field should be NO.
Hello,
I want write a python code block using " geoprocessing calculate field that adds a text field to the roads.shp feature class called FERRY. This new field should be populated with values of YES and NO depending on the value of the FEATURE field. If the value of the FEATURE field is ‘Ferry Crossing’, the value of the FERRY field should be YES – otherwise the value of theFERRY field should be NO.
if this is a field calculation, with "a" containing the data and "b" being updated
def calc(a): """ """ if a == "Ferry Crossing": return "YES" return "NO"
python parser
expression calculating into field "b"
calc(!a!)
Where the field name (a) is enclosed in !
You can use this code block and expression in CalculateField
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.