I tried using the same codeblock as Removing duplicates from field using ArcPy with ArcMap, but it is just copying the contents and not removing duplicates. I think my data is formatted the same.

What am I missing?


def delDups(n):
  return ', '.join(set(n.split(', ')))


delDups( !Names3! )

enter image description here

  • 2
    You split should say " ," ie space, comma.
    – FelixIP
    Mar 1, 2019 at 23:00

2 Answers 2


I think this should work with your data:

', '.join(set(filter(None, [b.strip() for b in n.split(',')])))

Strip to remove whitespaces before and after string, filter to remove empty strings, set to remove duplicates and then join back to a comma separated string:

a = ",East pass ,Iris Bloom Cir ,East pass"
', '.join(set(filter(None, [b.strip() for b in a.split(',')])))
'Iris Bloom Cir, East pass'

I wasn't able to get the two suggestions to work, but I had success when I reformatted the data with "&" enter image description here

and used:

def delDups(n):
 return ' & '.join(set(n.split(' & ')))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.