I am doing hydrology analysis in ArcMap 10.2 and have a drainage area feature class containing hundreds of records. Each record is assigned a drainage area name and acreage amount.

How do I sum all the acreage amounts for each drainage area name using a python script preferably in the field calculator?

  • gis.stackexchange.com/questions/118628/… may provide some ideas. – Richard Morgan Jan 18 '17 at 21:10
  • arcpy.Dissolve_management(feature_class,outputname,[drainage_field or fields],['Acres','SUM']) – ziggy Jan 18 '17 at 21:17
  • Welcome to GIS SE! As a new user be sure to take the Tour. For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet (or in this case an expression and code block) in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. – PolyGeo Jan 19 '17 at 5:26

If you do not necessarily need to use python to do this, you can use the Summary Statistics (Analysis) tool.


Select your acreage field as the Statistics Field(s) with a Statistic Type of SUM, and select your drainage area name field as the Case Field.

  • I agree - the Field Calculator is the wrong tool for trying to do this, irrespective of whether it can be done using it. – PolyGeo Jan 19 '17 at 5:25

You can do this, somewhat cumbersomely, in the field calculator like:

Parser: Python




def my_func(group):
  sum_field = 'YOUR_SUM_FIELD'
  group_field = 'YOUR_GROUP_FIELD'
  wc = "{0} = {1}".format(arcpy.AddFieldDelimiters(fc,group_field),group)
  return sum([i[0] for i in arcpy.da.SearchCursor(fc,sum_field,wc)])

Not the answer you're looking for? Browse other questions tagged or ask your own question.