I have a landcover polygon that I spatially joined to a soils polygon. This left me with many duplicate soil types in each row of the landcover polygon. I would like to summarize the soil types to only show a list of unique string values. How would I go about doing this in the field calculator?
1 Answer
With Field calculator and python parser:
Convert the string to a list with split
Convert the list to a set, which cant have duplicates
Join the set into a string
def nodups(soilnames):
return ', '.join(set(soilnames.split(', ')))
Call with:
nodups(!Soil Names!)
-
1Than you so much. This has been weighing on me for a few days, and your explanation was very helpful. Commented Jan 23, 2022 at 13:58
-