I am trying to add all of the counts in an attribute table, to get the total number of counts (I am trying to figure out the percent aspect for a polygon).
My code works fine, I am not getting any errors. I just need to know how to sum the "Count" row in the attribute table. I know how to do it in ArcMap, but I don't know how to write a code for the summarize statistics. I am using ArcGis 10.3
def getaspect(outras): TheRows = arcpy.SearchCursor(outras) for TheRow in TheRows: pixval = TheRow.getValue("VALUE") pixcount = TheRow.getValue("COUNT") count = TheRow.getValue("COUNT") print count if pixval == 3: shed = pixcount else: pass cellsize = arcpy.GetRasterProperties_management(outras, "CellSIZEX") cellsize = float(cellsize.getOutput(0)) pixarea = cellsize * cellsize print "writing new watershed" exfile = open("C:...Myworkspace.../List.txt", "a") aspect = shed * pixarea