ArcGIS Pro Calculator tool

529
3
10-20-2021 10:07 AM
KateEkhator74
New Contributor III

Hello,

Am trying to use  the calculate field tool in ArcGIS pro and I am not familiar with the python 3 if then statements and how to use the code block. Please can anyone help with some tips on how to  do this.

Thanks.

0 Kudos
3 Replies
JayantaPoddar
MVP Esteemed Contributor

Calculate Field Python examples—ArcGIS Pro | Documentation

You could use if, elif, else statements. e.g.

Expression:
Reclass(!WELL_YIELD!)

Code Block:
def Reclass(WellYield):
    if (WellYield >= 0 and WellYield <= 10):
        return 1
    elif (WellYield > 10 and WellYield <= 20):
        return 2
    elif (WellYield > 20 and WellYield <= 30):
        return 3
    elif (WellYield > 30):
        return 4

.  



Think Location
0 Kudos
KateEkhator74
New Contributor III

Thank you.

0 Kudos
jcarlson
MVP Esteemed Contributor

You might also consider trying Arcade. Arcade translates across to the ArcGIS Online environment, popup expressions, etc., and is worth learning.

- Josh Carlson
Kendall County GIS