maptastik
2/20/2019 - 2:00 PM

Get the max value for a numeric field in feature class

def max_field_fc_value(fc, field, number_type):
  max = 0
  
  with arcpy.da.SearchCursor(fc, field) as cursor:
    for row in cursor:
      if row[0] is not None:
        if number_type == 'int':
          val = int(row[0])
        elif number_type == 'float':
          val = float(row[0])
        
        if val > max:
          max = val
  
  return max