<?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 Re: List of unique values in multiple columns in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024735#M59872</link>
    <description>&lt;P&gt;Throws an error:&lt;/P&gt;&lt;P&gt;date_info_set = set(date_info_list)&lt;BR /&gt;TypeError: unhashable type: 'dict'&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2021 02:42:47 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-02-09T02:42:47Z</dc:date>
    <item>
      <title>List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024708#M59864</link>
      <description>&lt;P&gt;I need create a list of unique values from multiple date columns ("startSurvey" and "EndSurvey")...(I guess a list of lists is fine as long as I can iterate over it and grab the 2 unique values). In the end, I am trying to build sql for a separate SearchCursor.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-02-08_19-55-55.jpg" style="width: 767px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/5577iFF826BB119D1F3F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-08_19-55-55.jpg" alt="2021-02-08_19-55-55.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The desired result of the example needs to be:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[[StartSurvey: 6/5/2020 12:21:19 AM, EndSurvey: 6/5/2020 12:35:32 AM, [StartSurvey: 6/11/2020 12:42:05 AM, EndSurvey: 6/11/2020 5:13:18 AM]]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't necessarily have to be list of lists like this, but in some way that I can easily iterate over it to grab the unique StartDate/EndDate valules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 01:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024708#M59864</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T01:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024716#M59865</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It is indeed possible to structure your data as a list of lists. Personally though, my preference would be to use list of dictionaries instead. The main difference being&amp;nbsp; that elsewhere in your script when we go to access the data we've stored in the variable, we can refer to the start date and end date using a name that describe the information.&lt;/P&gt;&lt;P&gt;If we go with a list of lists, we need to keep track of which order we originally put these values into the sub-list. On small scale applications it's not a big deal keeping track of what order you put the data in there, but as scripts grow and change hands over the years - little things like this make scripts easier to understand and maintain.&lt;/P&gt;&lt;P&gt;I've outlined the code for both approaches below -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
fc = "C:/path/to/data.gdb/FeatureClass"
	
# Using a list of lists approach 
with arcpy.da.SearchCursor(fc, ["StartSuvey", "EndSurvey"]) as scur:
    # Use a list comprehension to pull the data out of the cusror
    date_info_list = [[row[0], row[1]] for row in scur]

for date_list in date_info_list:
    print("Start: {}, End: {}".format(date_list[0], date_list[1]))
	

# Using a list of dictionaries approach 
with arcpy.da.SearchCursor(fc, ["StartSuvey", "EndSurvey"]) as scur:
    # Use a list comprehension to pull the data out of the cusror 
    date_info_list = [{"start": row[0], "end": row[1]} for row in scur]

for date_dict in date_info_list:
    print("Start: {}, End: {}".date_dict["start"], date_dict["end"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 01:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024716#M59865</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T01:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024722#M59866</link>
      <description>&lt;P&gt;I'm not getting a unique list of StartSurvey and EndSurvey values.&amp;nbsp; Can you point out where this is supposed to happen in your example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 01:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024722#M59866</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T01:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024726#M59867</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Speaking from the experience of having to do pretty much the same thing before, repeatedly, all I can say is that the a &lt;STRONG&gt;List of Dictionaries&lt;/STRONG&gt; as suggested above by&amp;nbsp;@Anonymous User&amp;nbsp;is the way you want to go.&lt;BR /&gt;It will make incorporating your code&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;much&lt;/EM&gt; &lt;/STRONG&gt;easier.&lt;/P&gt;&lt;P&gt;The only thing I would add would be to use a unique ID to help pull out the exact record that you want:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Using a list of dictionaries approach 
with arcpy.da.SearchCursor(fc, ["JoinID", "StartSuvey", "EndSurvey"]) as scur:
    # Use a list comprehension to pull the data out of the cusror 
    date_info_list = [{"ID": row[0], "start": row[1], "end": row[2]}} for row in scur]&lt;/LI-CODE&gt;&lt;P&gt;(Use which ever field would be most appropriate instead of Join ID, just used that as it was the only unique ID I could see from your table)&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:03:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024726#M59867</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T02:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024728#M59868</link>
      <description>&lt;P&gt;Maybe I'm missing the obvious, but when I run and print the suggested solution I don't see unique dates.&amp;nbsp; That is, I get this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[
  {
    "start": "2020-05-27 23:44:17",
    "guid": "{A6618411-6CF7-4D7C-9D11-C6F73AC6BC1B}",
    "end": "2020-05-28 05:22:50"
  },
  {
    "start": "2020-05-27 23:44:17",
    "guid": "{A6618411-6CF7-4D7C-9D11-C6F73AC6BC1B}",
    "end": "2020-05-28 05:22:50"
  },
  {
    "start": "2020-05-27 23:44:17",
    "guid": "{A6618411-6CF7-4D7C-9D11-C6F73AC6BC1B}",
    "end": "2020-05-28 05:22:50"
  },
  {
    "start": "2020-06-04 00:19:40",
    "guid": "{8C6FCDEC-4BF1-4A71-8479-2925952A0993}",
    "end": "2020-06-04 04:23:58"
  },
  {
    "start": "2020-06-04 00:19:40",
    "guid": "{8C6FCDEC-4BF1-4A71-8479-2925952A0993}",
    "end": "2020-06-04 04:23:58"
  },
  {
    "start": "2020-06-04 00:19:40",
    "guid": "{8C6FCDEC-4BF1-4A71-8479-2925952A0993}",
    "end": "2020-06-04 04:23:58"
  }
 ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I need this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[
  {
    "start": "2020-05-27 23:44:17",
    "guid": "{A6618411-6CF7-4D7C-9D11-C6F73AC6BC1B}",
    "end": "2020-05-28 05:22:50"
  },  
  {
    "start": "2020-06-04 00:19:40",
    "guid": "{8C6FCDEC-4BF1-4A71-8479-2925952A0993}",
    "end": "2020-06-04 04:23:58"
  }
 ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024728#M59868</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T02:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024731#M59869</link>
      <description>&lt;P&gt;By example... a small table with 10K records pulling out the unique combinations from 3 fields&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcpy.da import TableToNumPyArray, NumPyArrayToTable
f = r"C:\arcpro_npg\npg\Project_npg\npgeom.gdb\sample_10k"
arr = TableToNumPyArray(f, "*")

flds = arr.dtype.names  # ---- to get all the fields
sub = arr[['County', 'Town_class', 'Facility']]  # --- subsample from 3 fields
sub.shape
(9996,)

uni, idx, cnts = np.unique(sub, True, return_counts=True)
uni.shape
(24,)

uni
array([('A', 'A_', 'Hall'), ('A', 'A_', 'Hosp'), ('A', 'B_', 'Hall'),
       ('A', 'B_', 'Hosp'), ('A', 'C_', 'Hall'), ('A', 'C_', 'Hosp'),
       ('B', 'A_', 'Hall'), ('B', 'A_', 'Hosp'), ('B', 'B_', 'Hall'),
       ('B', 'B_', 'Hosp'), ('B', 'C_', 'Hall'), ('B', 'C_', 'Hosp'),
       ('C', 'A_', 'Hall'), ('C', 'A_', 'Hosp'), ('C', 'B_', 'Hall'),
       ('C', 'B_', 'Hosp'), ('C', 'C_', 'Hall'), ('C', 'C_', 'Hosp'),
       ('D', 'A_', 'Hall'), ('D', 'A_', 'Hosp'), ('D', 'B_', 'Hall'),
       ('D', 'B_', 'Hosp'), ('D', 'C_', 'Hall'), ('D', 'C_', 'Hosp')],
      dtype={'names':['County','Town_class','Facility'], 'formats':['&amp;lt;U4','&amp;lt;U12','&amp;lt;U16'], 'offsets':[8,24,72], 'itemsize':2184})

# ----
# NumPyArrayToTable  =====&amp;gt;  and back to Arc-world&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:21:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024731#M59869</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-09T02:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024733#M59870</link>
      <description>&lt;P&gt;I get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;arr = TableToNumPyArray(fc, "*")&lt;BR /&gt;TypeError: long() argument must be a string or a number, not 'NoneType'&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:34:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024733#M59870</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T02:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024734#M59871</link>
      <description>&lt;P&gt;ahh, ok&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/8274"&gt;@JamesCrandall&lt;/a&gt;&amp;nbsp;my bad I was leading you down the wrong path.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if you just want a list of unique dates, then use&amp;nbsp;@Anonymous User&amp;nbsp;s original list of dictionaries method and don't worry about the unique ID.&lt;/P&gt;&lt;P&gt;Then convert the list to a set, which will show only unique entries in a list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Using a list of dictionaries approach 
with arcpy.da.SearchCursor(fc, ["StartSuvey", "EndSurvey"]) as scur:
    # Use a list comprehension to pull the data out of the cusror 
    date_info_list = [{"start": row[0], "end": row[1]} for row in scur]
date_info_set = set(date_info_list)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024734#M59871</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T02:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024735#M59872</link>
      <description>&lt;P&gt;Throws an error:&lt;/P&gt;&lt;P&gt;date_info_set = set(date_info_list)&lt;BR /&gt;TypeError: unhashable type: 'dict'&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024735#M59872</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T02:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024739#M59873</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/tabletonumpyarray.htm" target="_blank"&gt;TableToNumPyArray—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.7.x&amp;nbsp; Python 3.6.whatever&lt;/P&gt;&lt;P&gt;You don't indicate what fc is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just gave a command line example... the principle is the same.&amp;nbsp; If you prefer functions, here are two that I have used for years.&lt;/P&gt;&lt;P&gt;Do you have nulls in your table?&amp;nbsp; if so, there are other parameters you can specify.&lt;/P&gt;&lt;P&gt;I don't allow nulls in my tables, but if I get one, I fix it and use a function to call the helper&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Helper script&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def make_nulls(in_fc, include_oid=True, int_null=-999):
    """Return null values for a list of fields objects.

    Thes excludes objectid and geometry related fields.
    Throw in whatever else you want.

    Parameters
    ----------
    in_fc : featureclass or featureclass table
        Uses arcpy.ListFields to get a list of featureclass/table fields.
    include_oid : boolean
        Include the `object id` field to denote unique records and geometry
        in featureclasses or geodatabase tables.  This is recommended, if you
        wish to join attributes back to geometry.
    int_null : integer
        A default to use for integer nulls since there is no ``nan`` equivalent
        Other options include

    &amp;gt;&amp;gt;&amp;gt; np.iinfo(np.int32).min # -2147483648
    &amp;gt;&amp;gt;&amp;gt; np.iinfo(np.int16).min # -32768
    &amp;gt;&amp;gt;&amp;gt; np.iinfo(np.int8).min  # -128

    &amp;gt;&amp;gt;&amp;gt; [i for i in cur.__iter__()]
    &amp;gt;&amp;gt;&amp;gt; [[j if j else -999 for j in i] for i in cur.__iter__() ]

    Notes
    -----
    The output objectid and geometry fields are renamed to
    `OID_`, `X_cent`, `Y_cent`, where the latter two are the centroid values.
    """
    nulls = {'Double': np.nan, 'Single': np.nan, 'Float': np.nan,
             'Short': int_null, 'SmallInteger': int_null, 'Long': int_null,
             'Integer': int_null, 'String': str(None), 'Text': str(None),
             'Date': np.datetime64('NaT'), 'Geometry': np.nan}
    #
    desc = Describe(in_fc)
    if desc['dataType'] not in ('FeatureClass', 'Table'):
        print("Only Featureclasses and tables are supported")
        return None, None
    in_flds = desc['fields']
    good = [f for f in in_flds if f.editable and f.type != 'Geometry']
    # good = [f for f in in_flds if f.type != 'Geometry']
    fld_dict = {f.name: f.type for f in good}
    fld_names = list(fld_dict.keys())
    null_dict = {f: nulls[fld_dict[f]] for f in fld_names}
    # -- insert the OBJECTID field
    if include_oid and desc['hasOID']:
        oid_name = desc['OIDFieldName']
        oi = {oid_name: -999}
        null_dict = dict(list(oi.items()) + list(null_dict.items()))
        fld_names.insert(0, oid_name)
    return null_dict, fld_names&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Main script to read tables and fix nulls&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Featureclass table attribute data
def tbl_data(in_tbl):
    """Pull all editable attributes from a featureclass tables.

    During the process, &amp;lt;null&amp;gt; values are changed to an appropriate type.

    Parameters
    ----------
    in_tbl : text
        Path to the input featureclass.

    Notes
    -----
    The output objectid and geometry fields are renamed to
    `OID_`, `X_cent`, `Y_cent`, where the latter two are the centroid values.
    """
    flds = ['OID@']
    null_dict, fld_names = make_nulls(in_tbl, include_oid=True, int_null=-999)
    if flds not in fld_names:
        new_names = out_flds = fld_names
    if fld_names[0] == 'OID@':
        out_flds = flds + fld_names[1:]
        new_names = ['OID_', 'X_cent', 'Y_cent'] + out_flds[3:]
    a = TableToNumPyArray(
        in_tbl, out_flds, skip_nulls=False, null_value=null_dict
    )
    a.dtype.names = new_names
    return np.asarray(a)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:50:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024739#M59873</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-09T02:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024740#M59874</link>
      <description>&lt;P&gt;dicts aren't hashable, I am not sure that set() would work.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:50:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024740#M59874</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T02:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024742#M59875</link>
      <description>&lt;P&gt;This should give you a unique list of tuples.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;date_info_list = list(set([(row[0], row[1]) for row in arcpy.da.SearchCursor(fc, ["StartSuvey", "EndSurvey"])]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 03:01:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024742#M59875</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T03:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024744#M59877</link>
      <description>&lt;P&gt;That does it!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 03:18:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024744#M59877</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-02-09T03:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: List of unique values in multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024745#M59878</link>
      <description>&lt;P&gt;Ah my apologies, I missed the part where we're looking to de-duplicate the data. There's a number of different ways to skin that cat, but here's one that'll capture one entry per unique GUID for you by using the GUID as the key to a dictionary.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
fc = "C:/path/to/data.gdb/FeatureClass"

unique_entries = dict()
with arcpy.da.SearchCursor(fc, ["GUID", "StartSuvey", "EndSurvey"]) as scur:
    unique_entries[row[0]] = {"start": row[1], "end": row[2]}

with arcpy.da.SearchCursor(fc, ["GUID"]) as scur:	
	unique_GUIDs = list(set([row[0] for row in scur]))

for GUID in unique_GUIDs:
    print("Start: {}, End: {}".format(unique_entries[GUID]["start"], unique_entries[GUID]["end"])) 	
	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 03:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-unique-values-in-multiple-columns/m-p/1024745#M59878</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-09T03:21:41Z</dc:date>
    </item>
  </channel>
</rss>

