Guest User

Untitled

a guest
Jan 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. b = sum(row[0] for row in arcpy.da.SearchCursor(fc, 'QUANTITY_SOLID'))
  2.  
  3. with arcpy.da.UpdateCursor(fc, ['QUANTITY_SOLID_SUM']) as cursor:
  4. for row in cursor:
  5.  
  6. row[0] = b
  7. cursor.updateRow(row)
  8.  
  9. import arcpy
  10.  
  11. # Define the feature class
  12. fc = r'C:pathtoyourfc'
  13.  
  14. # Use a generator expression to populate a list from the 'QUANTITY_SOLID' field
  15. b = sum(row[0] for row in arcpy.da.SearchCursor(fc, 'QUANTITY_SOLID'))
  16.  
  17. with arcpy.da.UpdateCursor(fc, ['QUANTITY_SOLID_SUM']) as cursor:
  18. for row in cursor:
  19. row[0] = b
  20. cursor.updateRow(row)
Add Comment
Please, Sign In to add comment