Using Python in the Field Calculator
Using Python to Compute Field Values
You can use Python to create much more complex operations in the Field Calculator than you can normally enter.
- Open the Field Calculator in ArcMap
- Switch the "Parser" to "Python"
- Check "Show Code block
- Create a Python function in the "Pre-Logic Script Code:" section. Make the function return a value that will be placed in the attribute
- In the section at the bottom of the dialog, create a function that calls you function in the "Pre-Logic" section. Double click on the attribute you want to send into the function and you'll see ArcMap adds exclamation points on either side of the attribute name. This tells ArcMap to replace the attribute name, and the exclamation points, with the values for each of the attributes.
Contributed by Lindsey Holm