0

The shapefile table is like this. enter image description here

I want to do the sum of cells when their field names meet the condition. In this case, I want to sum the cells to the TotalCT field if the field name contains the string "CT". The manual way is to do it like this. enter image description here

But this is only a very small example. I wonder how can I realize it with Python or Arcpy code?

1 Answer 1

1

You seem to know how to do this in the ArcGIS Field Calculator.

Instead, do exactly the same thing using the Calculate Field tool, taking care to set your parser to Python.

Once you have run the tool you can use the Geoprocessing | Results window to locate and right-click on the tool to Copy As Python Snippet.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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