<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Remove duplicates in attribute field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416379#M70484</link>
    <description>&lt;P&gt;I have a field with space delimited values eg.:&lt;/P&gt;&lt;PRE&gt;26199 42448 42448 42454 42483 42497&lt;/PRE&gt;&lt;P&gt;Tried using pandas etc to explode, strip, split, etc. to list values and recreate as unique values to remove duplicates. Nothing seems to be stringing together to get my desired result:&lt;/P&gt;&lt;PRE&gt;26199 42448 42454 42483 42497&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have several thousand rows and need to check for duplicates for all of them, and then update the row values.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2024 07:23:12 GMT</pubDate>
    <dc:creator>CPoynter</dc:creator>
    <dc:date>2024-04-29T07:23:12Z</dc:date>
    <item>
      <title>Remove duplicates in attribute field</title>
      <link>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416379#M70484</link>
      <description>&lt;P&gt;I have a field with space delimited values eg.:&lt;/P&gt;&lt;PRE&gt;26199 42448 42448 42454 42483 42497&lt;/PRE&gt;&lt;P&gt;Tried using pandas etc to explode, strip, split, etc. to list values and recreate as unique values to remove duplicates. Nothing seems to be stringing together to get my desired result:&lt;/P&gt;&lt;PRE&gt;26199 42448 42454 42483 42497&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have several thousand rows and need to check for duplicates for all of them, and then update the row values.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 07:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416379#M70484</guid>
      <dc:creator>CPoynter</dc:creator>
      <dc:date>2024-04-29T07:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicates in attribute field</title>
      <link>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416387#M70485</link>
      <description>&lt;P&gt;code block&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import numpy as np
def rem_dups(row, sep=' '):
    """Remove duplicates in a string in a row separated by `sep`"""
    s = row.split(sep)
    a = np.array(s)
    u = np.unique(a)
    return " ".join([i for i in u])

row = "26199 42448 42448 42454 42483 42497"

rem_dups(row, sep=' ')
'26199 42448 42454 42483 42497'&lt;/LI-CODE&gt;&lt;P&gt;expression&lt;/P&gt;&lt;P&gt;rem_dups(!YourFieldName!, sep=' ')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 08:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416387#M70485</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-04-29T08:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicates in attribute field</title>
      <link>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416531#M70486</link>
      <description>&lt;P&gt;Does the order of these values matter after you remove duplicates?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 14:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-duplicates-in-attribute-field/m-p/1416531#M70486</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-04-29T14:50:33Z</dc:date>
    </item>
  </channel>
</rss>

