AnsweredAssumed Answered

combining rows in a table

Question asked by desertsp on Sep 22, 2016

I have a personal geodatabase table which I'd like to process in Python. Thought I'd see if someone has some existing code to accomplish this specific task, before I set out to learn how do to this myself! (very limited Python experience thus far)

 

Basically, a large set of records (a few tens of thousands) which represent a sort of linear referencing system (locations are not defined numerically). The  structure is below:

 

Primary_KeyFrom_LocationTo_Location
1001AB
1100BC
1001CD
1001FK
1001KM

 

The objective is to "combine" rows where the previous row's "To_Location" equals the current row's "From_Location", within the same Primary Key. The records will already be sorted appropriately (by primary_key, then from_location, then to_location). Basically, this is equivalent to the "dissolve" function. There are an unknown number of records per primary key.the 2nd row in the table should have primary key = 1001, NOT 1001, this forum editor is bogging down my computer and I cannot edit the table...sorry! 

 

So the output should be:

Header 1Header 2Header 3
1001AD
1001FM

Outcomes