Remove duplicates from a field

You need to:

  • Use an update cursor
  • Split the string into a list
  • Remove duplicates
  • Put the list back into a string
  • Assign the string to that row/field
  • Apply the update

Try this:

import arcpy
duplicates = "G:\\xStreetNew\\Duplicates.shp"

with arcpy.da.UpdateCursor(duplicates, ['Intersecti']) as cur:
    for row in cur:
        row[0] = ','.join(list(set(row[0].split(','))))
        cur.updateRow(row)

Or--for clarity-- you could replace the jumbled, multi-operation line, like this:

import arcpy
duplicates = "G:\\xStreetNew\\Duplicates.shp"

with arcpy.da.UpdateCursor(duplicates, ['Intersecti']) as cur:
    for row in cur:
        v = row[0]
        v = v.split(',')
        v = list(set(v))
        v = ','.join(v)
        row[0] = v
        cur.updateRow(row)

Tom's answer is great. However, I'll post how this can be achieved in the field calculator.

It's a simple function:

Codeblock:

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

Expression:

delDups( !Intersecti!)

Screenshot:

enter image description here