This is my scenario:
In terms of efficiency, I don't know which one is the best option:
A) Iterate through the list first; for each value of the list I start running through the shapefile asking for a match and do the update.Example: for 3 names; 3,000 reading operations on the shapefile.
B) Iterate through the shapefile first; for each record of the shapefile I look for a match on the list by iterating through the list each time.Example: for 3 names; 1,000 reading operations on the shapefile.
C) Use a dictionary instead, no list. Iterate through the shapefile first, and for each record, ask the dictionary for a value, if any, and do the update.Example: for 3 names; 1,000 reading operations on the shapefile.
أكثر...
- List of names in a python list: a[]
- A 1000 records shapefile with a column: 'name' (populated)
- A second column called 'value'
- ArcGIS environment (arcpy)
In terms of efficiency, I don't know which one is the best option:
A) Iterate through the list first; for each value of the list I start running through the shapefile asking for a match and do the update.Example: for 3 names; 3,000 reading operations on the shapefile.
B) Iterate through the shapefile first; for each record of the shapefile I look for a match on the list by iterating through the list each time.Example: for 3 names; 1,000 reading operations on the shapefile.
C) Use a dictionary instead, no list. Iterate through the shapefile first, and for each record, ask the dictionary for a value, if any, and do the update.Example: for 3 names; 1,000 reading operations on the shapefile.
أكثر...