I was wondering if it's possible to use the standard auto increment code to work on groups of records:
FeatureClass = "newFC" recs = collections.defaultdict(int) autoIncrementEXP = "autoIncrement()" expCalc = """def autoIncrement(!Group!): recs[!Group!] += 1 return recs[!Group!]""" arcpy.CalculateField_management(FeatureClass, "Number",autoIncrementEXP,"PYTHON",expCalc)
So instead of having the auto increment portion of the script stop when it reaches the end of the records, have it create sequential numbers using field value groups if that makes sense. You would start with something like the
Group field below and end with the
Number field containing the increment values:
Group Number A 1 A 2 A 3 B 1 B 2 C 1 C 2 C 3 C 4 C 5
Thanks for any insight you can provide.