I am working in the Field Calculator in ArcGIS Pro. I need to assign each item in a dataset with a group ID value, based on the IndexPercent field. There are multiple features with the same IndexPercent value, and they need to be grouped together. In addition, repeating values need to be skipped. I will attempt to write out what I mean below.
Say the first three features in the table have a IndexPercent value of 2. Because they have the same IndexPercent value, the group ID for each of the three features should be 1. The fourth and fifth features have an IndexPercent value of 3. The group ID for these two features should be 4, since the second and third features had the same IndexPercent value as the first feature. This pattern is continuous and nonregular.
d={} def GroupOrder(groupID): N=d.get(groupID,0);N+=1 d[groupID]=N return N
This got me a little further but is still not correct.