I have a table (T1) which I need to populate (using python for ArcGIS) the fields Val1, Val2 and Val3
ID Val1 Val2 Val3
0
1
2
with data from another table (T2):
ID Data
0 V1
1 V1
2 V1
0 V2
1 V2
2 V2
0 V3
1 V3
2 V3
so the original table (T1) becomes:
ID Val1 Val2 Val3
0 V1 V2 V3
1 V1 V2 V3
2 V1 V2 V3
I currently do this using a SearchCursor nested in the UpdateCursor.
I thought a quicker solution would be to split T2 into three columns or a temporary table, and then update T1 using the update cursor.
Can anyone help me with this?
My code currently:
rows = arcpy.UpdateCursor(Flow_Paths)
for row in rows:
X_A = row.X_Cord_A # First X Cord
Y_A = row.Y_Cord_A # First Y Cord
rows_i = arcpy.SearchCursor(point_shp)
for row_i in rows_i:
if X_A == row_i.xCentroid and Y_A == row_i.yCentroid: #Find upstream path lengths and extract maximum lengths, elevations, and min area
ElevationMax = row_i.DEM
AreaMin = row_i.CatchArea
Best Answer
My answer is quite specific to the situation but will post in case it helps anyone else.
I loop over the dbf and add the values to a vector (or column). Then the SplitCol splits my T2 table in the question above into 3 columns. I then loop over the dbf file and add the indexed results from the matrix as required.