<?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: HOW TO VALUE ROW COUNT? in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137756#M4693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Thank You For Your Answer. The&lt;BR /&gt;Frequency Tool Make A Tbl(Output) Which Is Good, But I Need The Result Inside&lt;BR /&gt;The Code&lt;/P&gt;&lt;P&gt;AVI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2015 07:54:47 GMT</pubDate>
    <dc:creator>avidavid</dc:creator>
    <dc:date>2015-03-11T07:54:47Z</dc:date>
    <item>
      <title>HOW TO VALUE ROW COUNT?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137754#M4691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I Have A Fc With A Field Which Contain&lt;BR /&gt;1,2,3 Value&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I Need To Write A Code That Give Me&lt;BR /&gt;The Total Count For Each Value&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;1=29&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;2=52&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;3=57&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;this is the code&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;print "start&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;arcpy.env.overwriteOutput = 1&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;fc =r"D:\AVI_DAVID\zevel\zevel.gdb\Export_Output_miv_cur&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;lst_field =arcpy.ListFields(fc,"USAGE")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # usage is the field&lt;/P&gt;&lt;P&gt;for f in lst_field&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print f.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;DO I NEED A SEARCHCURSOR? OR&lt;BR /&gt;UPDATECURSOR&lt;SPAN lang="HE" style="font-family: 'Arial','sans-serif'; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"&gt;? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;AVI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 15:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137754#M4691</guid>
      <dc:creator>avidavid</dc:creator>
      <dc:date>2015-03-10T15:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO VALUE ROW COUNT?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137755#M4692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Summary_Statistics/00080000001z000000/"&gt;Summary Statistics&lt;/A&gt; if you have an Advanced license, check out the Frequency tool while you are there&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 20:53:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137755#M4692</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-03-10T20:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO VALUE ROW COUNT?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137756#M4693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Thank You For Your Answer. The&lt;BR /&gt;Frequency Tool Make A Tbl(Output) Which Is Good, But I Need The Result Inside&lt;BR /&gt;The Code&lt;/P&gt;&lt;P&gt;AVI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 07:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137756#M4693</guid>
      <dc:creator>avidavid</dc:creator>
      <dc:date>2015-03-11T07:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO VALUE ROW COUNT?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137757#M4694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the same as Frequency( Frequency better)...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 08:25:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137757#M4694</guid>
      <dc:creator>avidavid</dc:creator>
      <dc:date>2015-03-11T08:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO VALUE ROW COUNT?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137758#M4695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what you mean by the result in the code...do you need the code to perform the task?&amp;nbsp; If so, use the snippet from the help files or from the Results window after a successful run of the tool.&lt;/P&gt;&lt;P&gt;If need the actual results as a variable for further use in your code, you will have to use an arcpy.da searchcursor and I use numpy to do the grunt work.&amp;nbsp; totally untested, but the sequence would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the help files on arcpy.da.searchcursor&lt;/P&gt;&lt;P&gt;Try this from the command line in your IDE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
input_shp = 'c:/yourpath/yourfilename.shp'
input_field = 'num_field'&amp;nbsp;&amp;nbsp; # an integer field as an example
values = [row[0] for row in arcpy.da.SearchCursor(input_shp, input_field)]
uniqueValues = set(values)&amp;nbsp; #from the help files&lt;/PRE&gt;&lt;P&gt;that will get you the values in the field, and their unique classes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tend to switch over to numpy if I already haven't converted the whole file to an array already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import numpy as np
&amp;gt;&amp;gt;&amp;gt; data = [1,2,2,2,1,1,1,3,3,2,3,3,4]
&amp;gt;&amp;gt;&amp;gt; classes = np.unique(data)
&amp;gt;&amp;gt;&amp;gt; freq = np.histogram(data,classes)
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; classes
array([1, 2, 3, 4])
&amp;gt;&amp;gt;&amp;gt; freq
(array([4, 4, 5]), array([1, 2, 3, 4]))
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which as you can see, there are 4 1's, four 2s, and 5 &amp;gt; 3&lt;/P&gt;&lt;P&gt;if you want an exact count, then you can play around with the bins as in this example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; data = [1,2,2,2,1,1,1,3,3,2,3,3,4]
&amp;gt;&amp;gt;&amp;gt; classes = np.unique(data)
&amp;gt;&amp;gt;&amp;gt; classes = np.unique(data).tolist()
&amp;gt;&amp;gt;&amp;gt; classes.append(classes[-1]+1)
&amp;gt;&amp;gt;&amp;gt; classes
[1, 2, 3, 4, 5]
&amp;gt;&amp;gt;&amp;gt; freq = np.histogram(data,classes)
&amp;gt;&amp;gt;&amp;gt; freq
(array([4, 4, 4, 1]), array([1, 2, 3, 4, 5]))
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;Of course, you can incorporate the command line stuff in your code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:38:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-value-row-count/m-p/137758#M4695</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T07:38:41Z</dc:date>
    </item>
  </channel>
</rss>

