AnsweredAssumed Answered

Subtract two specific values

Question asked by clintoncooper on Oct 25, 2013
Latest reply on Feb 25, 2014 by Movies989
I have a table that has several records that I have given a sequence number to based on the find identical tool that creates a new field which creates a new sequence number if they are identical.  Some features are unique while others may have up to 12 identical features.  I created a third filed which is a concatenation of the feat_seq field and an age field of which I can sort to get an order of age from oldest to youngest.  I would like to subtract the first two values, the oldest from the second oldest while not preforming this subtraction if there is less than 1 identical feature.  Additionally, if there are more than 3 identical features, it would only subtract the first two and none of the other ones.  Here is a sample of what the data might look like:

id age newid difference in age
2257 72 225772 n/a
2257 62 225762 10
2258 45 225845 0
2259 58 225958 n/a
2259 57 225957 1
2259 27 225927 n/a
2259 24 225924 n/a

I have found some code/thread (  that will subtract each value starting from the first value all through the end.  I was wondering if it is possible to specify which rows to subtract and which ones not to subtract using python ?