Hot answers tagged

4

This is a limitation of Shapefiles which cannot store both date and time in the same field. The ESRI documentation at https://pro.arcgis.com/en/pro-app/help/data/tables/date-fields.htm says: When calculating date fields, the field calculator uses Python datetime functions. Some of the functions support datetime yyyy-mm-dd hh:mm:ss AM or PM. However, for ...


4

It looks like you’re setting the ‘cumulative’ field to the area of that record only, not the running total. Try replacing: row[1] = AreaValue with: row[1] = running


4

You can iterate twice, first SearchCursor then UpdateCursor. Store values in a Collections.defaultdict(list) then use set to remove duplicates and join to create a string of the list. import arcpy from collections import defaultdict fc = r'C:\data.gdb\featureclass' fields = ['number','category','combined'] d = defaultdict(list) with arcpy.da.SearchCursor(...


1

Thanks for the nudge, when creating the MWE I found I was reusing a field name by mistake. This was overwriting the results to appear like it did not do anything. The code now does what I tell it. Not sure yet if thats what I want. This code now works: # -*- coding: utf-8 -*- '''---------------------------------------------------------------------...


1

Your code is slow because you have nested cursors so for each row in the updatecursor you are creating a searchcursor and reading rows. You are also using the old searchcursor (not da.) which is slow. Instead first count all occurences once using collections.Counter. The result is is a dictionary with FieldA value as key and count as value, for example: {1:...


Only top voted, non community-wiki answers of a minimum length are eligible