Quantcast
Channel: Forums - ArcGIS for Desktop - General
Viewing all articles
Browse latest Browse all 2328

Add row to previous row, based on list membership?

$
0
0
Hello Everyone!

I'm hoping you can help me understand how to accomplish this..I can't quite figure it out.

I have a table of soil horizon data with 65,000 rows, divided into profiles by a key field ("cokey"). I'm trying to sequentially add up values in the "Mm" field, which I've mocked up in the "Mms" field. The idea is essentially this: Mms1 = Mm1, Mms2 = Mm2 + Mms1, Mms3 = Mm3 + Mms2, etc. I can see how to do that, but I need it to stop after running through all the values in a given cokey, and then start again on the next cokey --- and I can't figure that part out!

It seems like this could be accomplished with a for or while loop, looking at the cokey field, but I'm just not conversant enough with python to see how to do it. It would be relatively simple if there weren't a lot of different cokeys, but there are 15,000. Thus far, I've just been using the field calculator and doing it by hand-ish.


hzname cokey Mm Mms
Ap
2394285:1983990
148.47 148.47
A1
2394285:1983990
145.56 294.03
A2
2394285:1983990
141.92 435.95
A1
2375401:1395410
154.66 154.66
A2
2375401:1395410
154.66 309.32
A3
2375401:1395410
154.66 463.97
Bw
2375401:1395410
149.44 613.42



Any help or suggestions would be very much appreciated. Thanks!

Viewing all articles
Browse latest Browse all 2328

Trending Articles