I am very new to Python and my first attempt hasn't gone too well. I'm trying to overwrite a field that is a spatial join of a couple of features in order to, in the end, generate a beginning and ending street intersections listing.
Here is a link to my table. The field I'm trying to overwrite is the IntersectionList field.
As you can see, the IntersectionList has the SECONDARYN field names included due to the spatial join. All I need now, are those streets that are not in the SECONDARYN field in order to create a beginning/ending street listing.
Here is a visual example of what I'm trying to accomplish.
This is the code I tried to use via the Calculate Field tool:
fixUpIntersections(!IntersectionList!, !FULLNAME!) def fixUpIntersections(listAsString, streetname): names = listAsString.split(" & ") uniqueNames = list(set(names)) if len(uniqueNames) == 1: return uniqueNames uniqueNames.remove(streetname) return ' & '.join(sorted(uniqueNames))
I thought with the error I received, it meant that maybe I should !FULLNAME! to !SECONDARYN!, in order to get rid of those streets in the IntersectionList but when I tried that, it just deleted all data in the IntersectionList. Running the tool with the code exactly as shows above without changing !FULLNAME!, it resulted in the following error.
I've dug around the site here but haven't been able to figure out my problem. I have a long way to go to learn Python.