<?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: Count features in geodatabase in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26609#M2007</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What can you say about book &lt;SPAN style="text-decoration: underline;"&gt;Programming ArcGIS with Python Cookbook&lt;/SPAN&gt; (second edition) By Eric Pimpler?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Feb 2017 18:57:19 GMT</pubDate>
    <dc:creator>MihaKlemencic</dc:creator>
    <dc:date>2017-02-23T18:57:19Z</dc:date>
    <item>
      <title>Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26597#M1995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am new to python and I would to like to count the number of features in each feature class that meet certain criteria.&lt;/P&gt;&lt;P&gt;In geodatabase I have many feature classes. One of the attribute field has values "number/number" --&amp;gt; 50/2, 99/6&lt;/P&gt;&lt;P&gt;I would to like to loop each feature class, select layer by attribute and count selected features, which contain sign "&lt;STRONG&gt;/&lt;/STRONG&gt;" and print the result. Below is python code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;#Set the input workspace&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"d:/TMP/miha_k/zirovnica/novo/test.gdb"&lt;/SPAN&gt;

fcs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fcs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fcs&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PARCELA LIKE '%/%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fcs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; row‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate your help&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26597#M1995</guid>
      <dc:creator>MihaKlemencic</dc:creator>
      <dc:date>2021-12-10T21:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26598#M1996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;taking a wild guess that you got an error... what was it? what field are you querying in each table? is there any similarity between the tables? Have you done this manually? can you put your workflow into a model?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Just some ideas to get you started&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 17:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26598#M1996</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-02-22T17:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26599#M1997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A few things:&lt;/P&gt;&lt;P&gt;- Cursors cycle through individual features within a feature class/table. You don't seem to need that here.&lt;/P&gt;&lt;P&gt;- When you do 'for row in fcs:', the individual feature class is called row. The list of feature classes is fcs. So, you should select from row, not fcs.&lt;/P&gt;&lt;P&gt;- Refer to the help for &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/get-count.htm"&gt;GetCount&lt;/A&gt;, especially the example. Note that it returns a &lt;EM&gt;result&lt;/EM&gt;, not a &lt;EM&gt;number&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 17:35:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26599#M1997</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2017-02-22T17:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26600#M1998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Darren suggested, I don't think you would want to cycle through all your features; they might not have the fields you want to query anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's some code based on &lt;A href="http://gis.stackexchange.com/questions/30140" rel="nofollow noopener noreferrer" target="_blank"&gt;this link&lt;/A&gt;:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"d:/TMP/miha_k/zirovnica/novo/test.gdb"&lt;/SPAN&gt;
in_table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"featureToSearch"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# MakeTableView_management (in_table, out_view, {where_clause}, {workspace}, {field_info})&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"myTableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PARCELA LIKE '%/%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
count &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"myTableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, if your features all contain the same field in your where query, you could do a "for row in fcs" loop.&amp;nbsp; You could also add an if "feature in list" line to limit the features used.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:04:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26600#M1998</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26601#M1999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field "PARCELA" exits in all tables.&lt;/P&gt;&lt;P&gt;The workflow is:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;select by attributes&lt;/LI&gt;&lt;LI&gt;write query "PARCELA LIKE '%/%'"&lt;/LI&gt;&lt;LI&gt;Count selected features&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But doing this workflow manually on more than 100 feature classes is time consuming.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 18:23:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26601#M1999</guid>
      <dc:creator>MihaKlemencic</dc:creator>
      <dc:date>2017-02-22T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26602#M2000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To loop through all the features, you might try the following code.&amp;nbsp; However, if the where clause fails, you may get a count of all records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"d:/TMP/miha_k/zirovnica/novo/test.gdb"&lt;/SPAN&gt;

fcs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"myTableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PARCELA LIKE '%/%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"myTableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"myTableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:04:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26602#M2000</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26603#M2001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to add that you can test whether or not there is a selection by inspecting the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/tableview-properties.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;describe&lt;/A&gt; FIDSet property:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FIDSet &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'There is no selection'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'There is a selection'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:04:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26603#M2001</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-10T21:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26604#M2002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FIDSet is a &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/layer-properties.htm"&gt;Layer property&lt;/A&gt;, calling it will generate an attribute error if Describe is passed a feature class directly.&amp;nbsp; If a table view or feature layer is passed to Describe, then FIDSet should return a value, but I think &lt;A href="https://community.esri.com/people/rvburton"&gt;rvburton&lt;/A&gt;‌ approach obviates the need for checking FIDSet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:26:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26604#M2002</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-02-22T19:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26605#M2003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, yes, that's right. I was back on the original idea of using SelectLayerByAttributes, which now that I look at it, needs to be preceded by &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm"&gt;MakeFeatureLayer&lt;/A&gt;&amp;nbsp;(or MakeTableView).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26605#M2003</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2017-02-22T19:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26606#M2004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for help&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Really need to learn python for ArcGIS.&amp;nbsp;Can you suggest any of books?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 20:47:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26606#M2004</guid>
      <dc:creator>MihaKlemencic</dc:creator>
      <dc:date>2017-02-22T20:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26607#M2005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are quite a few threads in the forum for learning Python.&amp;nbsp; Do a quick search and you can find them.&amp;nbsp; Here is a start&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="1526" __jive_macro_name="polls" _jive_internal="true" class="jive_macro_polls jive_macro link-titled" href="https://community.esri.com/polls/1526"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 20:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26607#M2005</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-02-22T20:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26608#M2006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Follow &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌'s &lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson"&gt;Py... blog&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;2. Check out &lt;A _jive_internal="true" href="https://community.esri.com/docs/DOC-1927"&gt;Some Python Snippets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;3. Free online courses like &lt;A href="https://www.tutorialspoint.com/python/index.htm"&gt;Tutorials Point&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2017 22:03:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26608#M2006</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-02-22T22:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26609#M2007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What can you say about book &lt;SPAN style="text-decoration: underline;"&gt;Programming ArcGIS with Python Cookbook&lt;/SPAN&gt; (second edition) By Eric Pimpler?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2017 18:57:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26609#M2007</guid>
      <dc:creator>MihaKlemencic</dc:creator>
      <dc:date>2017-02-23T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26610#M2008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;EM&gt;Programming ArcGIS with Python Cookbook &lt;/EM&gt;book looks like a good resource and worth the investment.&amp;nbsp; I have found online resources to be just as valuable, if not more so, than&amp;nbsp;a few&amp;nbsp;good reference books. Knowing what and how to ask Google (etc.)&amp;nbsp;is an invaluable skill.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2017 19:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26610#M2008</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-02-23T19:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26611#M2009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was just looking for an answer to something, and came up with this online version (and found my answer)&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://www.diveintopython.net/" title="http://www.diveintopython.net/"&gt;Dive Into Python&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2017 19:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26611#M2009</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-02-23T19:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26612#M2010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://github.com/python"&gt;python on GitHub&lt;/A&gt;&amp;nbsp;and &lt;A href="https://www.python.org/"&gt;python.org&lt;/A&gt;&amp;nbsp;once the introductions are done, these are the source links to which all refer.&amp;nbsp; A slog perhaps? Not really if you like clarity and brevity&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2017 20:07:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26612#M2010</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-02-23T20:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26613#M2011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following function (first substituting the field index number for '10' for your search field.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;countfeaturesfun&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"/"&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Count&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26613#M2011</guid>
      <dc:creator>MaxMarno</dc:creator>
      <dc:date>2021-12-10T21:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26614#M2012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Technically, this works. I'm not always the one to do things the "right" way either, but there are a few reasons not to do it this way:&lt;/P&gt;&lt;P&gt;- you need to manually count the field index&lt;/P&gt;&lt;P&gt;- this method reads every feature in the feature class. Using a where clause only reads the matching features, through &lt;EM&gt;the magic of SQL&lt;/EM&gt;, which I don't understand, but from the &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/python/specifying-a-query.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;help&lt;/A&gt;, "&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;When a query is specified for an &lt;/SPAN&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/updatecursor-class.htm#GUID-5CBF0F12-3B31-41AC-A525-65829523F692" style="color: #007ac2; background-color: #fefefe;" rel="nofollow noopener noreferrer" target="_blank"&gt;update&lt;/A&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt; or &lt;/SPAN&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/searchcursor-class.htm#GUID-3CB1DFF4-983D-445F-9CB2-0FF1CD4B4880" style="color: #007ac2; background-color: #fefefe;" rel="nofollow noopener noreferrer" target="_blank"&gt;search&lt;/A&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt; cursor, only the records satisfying that query are returned." Anyhow, it seems to take about 3x longer to read through everything, but it likely depends on the data and how many matches there are. Also, to be fair, the results below are representative of several runs, except the first run, which adds about 3s in actually constructing the table view. So, I suppose the main point is that this method is just fine for small data sets, but likely worse for large data sets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import timeit
fc = 'bc_geoname_albers' # ~45,000 features

# SQL method
start_time = timeit.default_timer()
arcpy.MakeTableView_management(fc, "myTableView", "CGNDBKEY LIKE '%C%'")
Count = int(arcpy.GetCount_management("myTableView").getOutput(0))
print (Count,str(timeit.default_timer() - start_time))

# Count method
start_time = timeit.default_timer()
with arcpy.da.SearchCursor(fc, "*") as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Count = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "C" in str(row[4]):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count+=1
print (Count,timeit.default_timer() - start_time)

(13531, 0.64809157931) # SQL method: 0.65s
(13531, 1.87391371297) # Count method: 1.87s‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26614#M2012</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-10T21:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count features in geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26615#M2013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agreed, in considering processing time, your version would be quicker and more reliable.&amp;nbsp; However like you noted as well for a smaller dataset the difference would be negligible. Cheers to SQL!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2017 00:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-features-in-geodatabase/m-p/26615#M2013</guid>
      <dc:creator>MaxMarno</dc:creator>
      <dc:date>2017-02-24T00:03:32Z</dc:date>
    </item>
  </channel>
</rss>

