<?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: Get a count of field values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173328#M13350</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;numpy comes with pro... in fact arcgis pro requires numpy, so does the arcgis module, and pandas scipy etc etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this can be done with or without a clone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, as in all modules, you have to import numpy which is usually do as&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; numpy &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; np&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;most python IDEs allow you to set default imports if you feel lazy or are forgetful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jan 2020 18:27:22 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2020-01-08T18:27:22Z</dc:date>
    <item>
      <title>Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173323#M13345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working with some data that&amp;nbsp;is a ridiculously large table (184 fields) and I would like to asses how many instances of of each field are non-null.&amp;nbsp; In other words if the values are more more often null, I'll drop the field(s).&amp;nbsp; For now I've written a script that performs an iterative selection for each field, and as you can imagine with 184 fields and a few thousand records it's pretty slow.&amp;nbsp; I tried a couple other approaches that failed, but I have to think there is a better way to get a count of records for which a given field is populated.&amp;nbsp; Here is what I've done to date:&amp;nbsp;&amp;nbsp;&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

table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'J:\some\path\to\file.gdb\tableName'&lt;/SPAN&gt;
fields &lt;SPAN class="operator 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;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    fields&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'tv'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    select &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="string token"&gt;'{f} is not null'&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'tv'&lt;/SPAN&gt;&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;select&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    c &lt;SPAN class="operator 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;'tv'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Field {} has {} non-null records'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;c&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="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;/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>Sat, 11 Dec 2021 08:57:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173323#M13345</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T08:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173324#M13346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your current approach is the most "ArcGIS" way, i.e., using ArcGIS geoprocessing tools, of doing it.&amp;nbsp; The slowness is caused more by having 184 fields, which is a ridiculously excessive number of fields even for a data warehouse, than your approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If memory is abundant, you could load the whole dataset into a Python or NumPy data structure and then count the number of non-null values.&amp;nbsp; Counting in a Python or NumPy data structure should be much faster than your current approach, but you have to be able to load all the data into memory or paging will slow it down.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 16:56:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173324#M13346</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-08T16:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173325#M13347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As also stated by Joshua, iterating through 184 fields in arcpy is going to be slow. I suggest you leverage the arcgis module and the Spatially Enabled Data Frame (extension of pandas.DataFrame), maybe something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: black;"&gt;infc &lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #0000e6;"&gt;r"Path\To\Your\Data"&lt;/SPAN&gt;
&lt;SPAN style="color: black;"&gt;sedf &lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt; pandas&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;DataFrame&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;spatial&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;from_featureclass&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;infc&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: dimgray;"&gt;#Creates a pandas.DataFrame from your featureclass&lt;/SPAN&gt;
&lt;SPAN style="color: black;"&gt;idx &lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt; sedf&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;isnull&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;()&lt;/SPAN&gt; &lt;SPAN style="color: dimgray;"&gt;# Returns an index that is True for None, False otherwise&lt;/SPAN&gt;
&lt;SPAN style="color: black;"&gt;idx&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #400000;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;()&lt;/SPAN&gt; &lt;SPAN style="color: dimgray;"&gt;# True = 1, False = 0; idx.sum() will summarize each column to tell you how many null values are in that column&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will give you something like this:&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&gt;OBJECTID    0 
ORIG_FID    0 
DATA        8 
SHAPE       0 
dtype: int64&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173325#M13347</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2021-12-11T08:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173326#M13348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Small demo... you should use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flds = "*"&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;flds &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Parts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Int_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Float_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Text_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

d0 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToNumPyArray&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field_names&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;flds&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; skip_nulls&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; null_value&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;nd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

d1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToNumPyArray&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field_names&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;flds&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; skip_nulls&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

d0
 
array&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="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;    &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;      nan&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'a'&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="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;999&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;     &lt;SPAN class="number token"&gt;6.10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'None'&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="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;999&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;     &lt;SPAN class="number token"&gt;2.10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'None'&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;
      dtype&lt;SPAN class="operator 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="string token"&gt;'Parts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;i4'&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="string token"&gt;'Int_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;i4'&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="string token"&gt;'Float_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;f8'&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="string token"&gt;'Text_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;U5'&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;
d1
array&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;
      dtype&lt;SPAN class="operator 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="string token"&gt;'Parts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;i4'&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="string token"&gt;'Int_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;i4'&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="string token"&gt;'Float_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;f8'&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="string token"&gt;'Text_nulls'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'&amp;lt;U5'&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="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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;A table with 3 records and I samples some fields, I have a function to convert nulls of any kind so that they are converted from &amp;lt;null&amp;gt; to something useful (I blogged about this).&lt;/P&gt;&lt;P&gt;BUT!!! if you dump the nulls versus you keep the nulls&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;d1.shape
(0,)

d0.shape
(3,)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Way ******** faster than a search cursor &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:57:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173326#M13348</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173327#M13349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your solution done in Pro using only default python modules or did you need to add additional modules using the clone?&amp;nbsp; If needing the clone, what is the module(s) that you needed to add to execute your solution?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 18:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173327#M13349</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2020-01-08T18:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173328#M13350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;numpy comes with pro... in fact arcgis pro requires numpy, so does the arcgis module, and pandas scipy etc etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this can be done with or without a clone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, as in all modules, you have to import numpy which is usually do as&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; numpy &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; np&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;most python IDEs allow you to set default imports if you feel lazy or are forgetful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 18:27:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173328#M13350</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-08T18:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173329#M13351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wonder if just loading into memory then used the Arc way would be faster also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.FeatureClassToFeatureClass_conversion(old.gdb, "in_memory", "tempFC")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 21:42:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173329#M13351</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2020-01-08T21:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173330#M13352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;doubtful since it doesn't write to memory&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm"&gt;Get Count—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 22:22:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173330#M13352</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-08T22:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173331#M13353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You raise an interesting point/question.&amp;nbsp; At first, I thought the same as Dan but for different reasons.&amp;nbsp; Given the way that Windows 10 caches files in spare system memory, I thought there was a good chance that running Select Layer by Attribute on the same data set over and over would be hitting a cache and therefore not sped up much by moving the data to in-memory.&amp;nbsp; It turns out, I was wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did some testing on a feature class with a handful of columns but millions of rows of data.&amp;nbsp; I created a feature layer and then ran successive "IS NOT NULL" selections against the columns.&amp;nbsp; It turns out the first run was a bit slower but negligibly so.&amp;nbsp; All of the selections took about 8 seconds.&amp;nbsp; I then copied the feature class into memory workspace and repeated the test, and the selection ran in about 0.2 seconds.&amp;nbsp; So, copying the data into memory made a huge difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only caveat I would add is that in-memory won't help nearly as much if the data set can't actually fit in RAM.&amp;nbsp; If copying the data set results in ArcGIS paging some of the data to disk because there isn't enough RAM, the selections could be even slower than leaving them in the file GDB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 00:13:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173331#M13353</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-09T00:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173332#M13354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I knew it would work since I do it all the time &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;.&amp;nbsp; Arc is very chatty on the network (or hard drive).&amp;nbsp; So moving it to RAM eliminates all those calls to hardware.&amp;nbsp; Plus I guessed he was hitting SDE which means a network call, a server call, and a hard drive spin.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fit it in RAM use PyScripter 64 bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps the OP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 14:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173332#M13354</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2020-01-09T14:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173333#M13355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks guys- yes &lt;A href="https://community.esri.com/migrated-users/12477"&gt;Doug Browning&lt;/A&gt;‌ it does help, at least for future applications; this was a one and done sort of thing and I was able to press on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use spyder 64 bit as my ide, and ram is cheap these days so this approach seems pretty close to being universal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3420"&gt;Joshua Bixby&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 14:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173333#M13355</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-01-09T14:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get a count of field values</title>
      <link>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173334#M13356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@hziegler-esristaff way is what I have always used. &lt;A href="https://www.youtube.com/watch?v=A2w0BER2ptM"&gt;ArcPro 2.15&lt;/A&gt;&amp;nbsp;now allows toggling between desktop and spatially enabled dataframes. Additionally from the python API you can now launch, code within spatially referenced dataframes and save and share&amp;nbsp;as an item in ArcOnline. Apart from using numpy, can also use pandas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;df = pd.read_csv(r'file directory')&lt;/P&gt;&lt;P&gt;df.isna().sum() # for entire dataframe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df.fieldname.isna()&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The advantage with spatially dataframes is it levarages numpy and pandas to access statistical abilities that can otherwise be accessed 'cumbersomely' in arcpy. It also&amp;nbsp;accords excellent visualization in matplotlib and seaborn python libraries.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 04:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-a-count-of-field-values/m-p/173334#M13356</guid>
      <dc:creator>wwnde</dc:creator>
      <dc:date>2020-01-14T04:06:13Z</dc:date>
    </item>
  </channel>
</rss>

