# Python Minimum or Maximum Values in ArcGIS

## How to calculate minimum values using Python in ArcGIS

Suppose you have 2 separate segments in a quality table and you need to locate the base or most extreme qualities between these segments. This would require a touch of Python coding.

Suppose your fields are set up as follows:

 The first field as “rank1”

 The second field as “rank2”

 The third is an empty field “Min” to store the minimum value

## Stage 1 Use Field Calculator

Right-click the empty field “Min”, and select “Field Calculator… “. Select the Python radio box. Use the accompanying code:

FOR MINIMUM: min([!rank!, !rank2!])

After running the field calculator with the code above, the minimum values will be calculated in the “Min” field.

## How to calculate maximum values using Python in ArcGIS

So also, you can use the maximum function capacity to accomplish the most noteworthy incentive from various fields.

FOR MAXIMUM: max([!rank!, !rank2!])

After running the field mini-computer with the Python code over, the “Maximum” field will have the maximum value from the “rank1” and “rank2” fields.

## How to get maximum or minimum values using Python for multiple fields

Python has the adaptability to assess the base and most extreme qualities from numerous fields. After the comma, you can add extra fields to ascertain the least or most maximum values.

FOR MINIMUM: min([!rank!, !rank2!, !rank3!])

FOR MAXIMUM: max([!rank!, !rank2!, !rank3!])

After running the Python code above, the minimum and maximum values will be evaluated for multiple fields.

## More built-in functions

Python is a diverse programming language that can suit the needs of GIS users.

It has hundreds of functions readily available.

Built-in functions can be found in the Python documentation found on the Python Docs page.