Test your Python expressions

Try field calculations without editing your data. Use the interactive console below to input a string or numeric field value. Then enter a field calculation to see what happens.

Play in the sandbox

Transition to ArcGIS

After you use the sandbox, bring your skills to the Field Calculator. But be careful: field calculations will permenently alter your data. It's good practice to have a back-up copy and perform all field calculations in a brand new field.

You can test your code in 'main.py' before using the Field Calculator. Press the play button to try your expression.

Note: The sandbox supports Python expressions, but the Field Calculator in ArcMap also supports VB Script. In ArcGIS Pro, the Calculator Field tool supports Python, VBA, and Arcade expressions.

Test Python code blocks

The Calculate Field tool supports logical and accumulative functions, which are common advanced techniques. Experiment with the examples in logical.py and accumulate.py above.

Learn more about Python

Python is the language of GIS. If you can do it with Python, you can do it in the Field Calculator. Check out these resources to develop your Python skills and learn more about Python scripting for spatial analysis.

Time commitment Resource
Least involved Download an Esri cheat sheet of advanced logial functions for the Field Calculator
- Review the the offical Python docs when you know of a Python tool but want to learn how to use it
- Check out Python for ArcGIS, a free YouTube series from the University of Alaska
- Try out the exercises in Paul Zandbergen's how-to book, Python Scripting for ArcGIS
- Dive into Python scripting for spatial analysis with the lessons and tutorials in Python for Everyone, a free training by Esri
Most involved Learn Python from scratch with interactive tutorials on Codeacademy