This is my scenario:
- 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)
I want to update the column 'value' (i.e from 0 to 1) for all the shapefile records having a value in the column 'name' matching any of the list.
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.