<?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 List Unique Values in Multiple Columns in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1144160#M51503</link>
    <description>&lt;P&gt;When getting to know a feature class, or analyzing one I'm familiar with, the Frequency tool is helpful.&amp;nbsp; But if I'm not mistaken, Frequency is not available at all levels of ArcGIS Desktop.&amp;nbsp; Also, the Frequency tool always outputs a persisted table, and I don't always want that.&amp;nbsp; Here is how to generate a Pandas object consisting of unique combinations of values in multiple fields, along with counts of how frequently those combinations appear.&amp;nbsp; This code is mostly useful for text/string fields.&amp;nbsp; Other pandas properties are good for numeric fields, which is outside the scope of this post.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;In ArcGIS Pro, click the Insert tab &amp;gt; New Notebook (in the Project section of the ribbon)&lt;/LI&gt;&lt;LI&gt;Your first cell should read&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis, pandas​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Your second cell should read something like this, but the word in quotes should be the name of a layer in your map.&amp;nbsp; If you have records selected in this layer, then the DataFrame df will only contain those records.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;df = pandas.DataFrame.spatial.from_featureclass("Sidewalk Repair Inventory")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;DataFrame/Series filters are outside the scope of this post, but you can create one with syntax like this:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dfFiltered = df[df["STATUS"] == "CLOSED"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Obtain a statistics table with a line like this:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dfStats = dfFiltered.groupby(by=["Field1", "Field2"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;OL&gt;&lt;LI&gt;Lastly, you need a few short lines like this:&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;&lt;LI-CODE lang="python"&gt;result = dfFrequency.size()
print(result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry the formatting of this post is odd.&amp;nbsp; I couldn't fix it.&amp;nbsp; I don't know how, in this forum, to post an ordered list of steps while continuing the order below the code segments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 16:53:27 GMT</pubDate>
    <dc:creator>RogerDunnGIS</dc:creator>
    <dc:date>2022-02-15T16:53:27Z</dc:date>
    <item>
      <title>List Unique Values in Multiple Columns</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1144160#M51503</link>
      <description>&lt;P&gt;When getting to know a feature class, or analyzing one I'm familiar with, the Frequency tool is helpful.&amp;nbsp; But if I'm not mistaken, Frequency is not available at all levels of ArcGIS Desktop.&amp;nbsp; Also, the Frequency tool always outputs a persisted table, and I don't always want that.&amp;nbsp; Here is how to generate a Pandas object consisting of unique combinations of values in multiple fields, along with counts of how frequently those combinations appear.&amp;nbsp; This code is mostly useful for text/string fields.&amp;nbsp; Other pandas properties are good for numeric fields, which is outside the scope of this post.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;In ArcGIS Pro, click the Insert tab &amp;gt; New Notebook (in the Project section of the ribbon)&lt;/LI&gt;&lt;LI&gt;Your first cell should read&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis, pandas​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Your second cell should read something like this, but the word in quotes should be the name of a layer in your map.&amp;nbsp; If you have records selected in this layer, then the DataFrame df will only contain those records.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;df = pandas.DataFrame.spatial.from_featureclass("Sidewalk Repair Inventory")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;DataFrame/Series filters are outside the scope of this post, but you can create one with syntax like this:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dfFiltered = df[df["STATUS"] == "CLOSED"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Obtain a statistics table with a line like this:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dfStats = dfFiltered.groupby(by=["Field1", "Field2"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;OL&gt;&lt;LI&gt;Lastly, you need a few short lines like this:&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;&lt;LI-CODE lang="python"&gt;result = dfFrequency.size()
print(result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry the formatting of this post is odd.&amp;nbsp; I couldn't fix it.&amp;nbsp; I don't know how, in this forum, to post an ordered list of steps while continuing the order below the code segments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 16:53:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1144160#M51503</guid>
      <dc:creator>RogerDunnGIS</dc:creator>
      <dc:date>2022-02-15T16:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: List Unique Values in Multiple Columns</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1144335#M51517</link>
      <description>&lt;P&gt;I am not sure which product you are using, ArcGIS Desktop (ArcMap) or ArcGIS Pro, as you mentioned both.&amp;nbsp; If you are using ArcGIS Pro, I would like to mention two things for you:&lt;/P&gt;&lt;P&gt;1. Frequency is available at Basic licensing level.&lt;/P&gt;&lt;P&gt;2. Summary Statistics has an option:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class=""&gt;UNIQUE&lt;/SPAN&gt;—The number of unique values of the specified field will be counted.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/summary-statistics.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/summary-statistics.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope you can use ArcGIS Pro for your processing.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 22:01:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1144335#M51517</guid>
      <dc:creator>DanLee</dc:creator>
      <dc:date>2022-02-15T22:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: List Unique Values in Multiple Columns</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1145906#M51717</link>
      <description>&lt;P&gt;I wanted to add that charts are another effective way of exploring your data in ArcGIS Pro. Bar charts can help you quickly visualize the frequency distributions for categorical fields without needing to create an extra output table.&lt;/P&gt;&lt;P&gt;Here I’ve created a bar chart that shows the counts for AirBNB listings by the “neighbourhood_group” field:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="callen_esri_2-1645227738440.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34451i6B1713F80B24F164/image-size/large?v=v2&amp;amp;px=999" role="button" title="callen_esri_2-1645227738440.png" alt="callen_esri_2-1645227738440.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can even group the data by an additional categorical field by selecting the field in the &lt;STRONG&gt;Split by &lt;/STRONG&gt;dropdown. Here I’ve split the chart above by the “room_type” field, and now it displays the breakdown of AirBNB listings by “neighbourhood_group” and “room_type”:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="callen_esri_1-1645225966216.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34449i0A730E1D97FA1A61/image-size/large?v=v2&amp;amp;px=999" role="button" title="callen_esri_1-1645225966216.png" alt="callen_esri_1-1645225966216.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For more information on creating and configuring charts in ArcGIS Pro, please see the following documentation page:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/charts/charts-quick-tour.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/charts/charts-quick-tour.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 23:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/list-unique-values-in-multiple-columns/m-p/1145906#M51717</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2022-02-18T23:44:19Z</dc:date>
    </item>
  </channel>
</rss>

