<?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: arcpy: maximum of a field of a feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62117#M4980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dans Answer is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'C:/Your_spaceless_path/CoordGeom.gdb/Polygons'&lt;/SPAN&gt;

arr &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;TableToNumPyArray&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Shape_Area'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit;"&gt;# pick a field&lt;/SPAN&gt;

&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit;"&gt;# nan functions account for nulls, cast to the dtype of the field using astype &lt;/SPAN&gt;
np&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;nanmax&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;arr&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;astype&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'float'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&amp;nbsp; 

&lt;SPAN class="" style="color: #990000; border: 0px; font-weight: inherit;"&gt;155.0&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If this is returning different numbers based on selection, then this is because you are not entering "in_fc" as shwon above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'C:/Your_spaceless_path/CoordGeom.gdb/Polygons'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is different than:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Polygons'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One points to a layer in a map, and will return results based on selections and things, the other points to data on a disk, and will return counts of whatever is inside that dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only possible thing that could go wrong using this, is if a user is inside an Edit session, then there features are not saved to the "dataset on disk" until they save Edits.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:21:57 GMT</pubDate>
    <dc:creator>LukeWebb</dc:creator>
    <dc:date>2021-12-10T22:21:57Z</dc:date>
    <item>
      <title>arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62108#M4971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get the maximum of a field&amp;nbsp;in a feature class.&amp;nbsp; If no features are selected, I get the right value. But if some features are selected, I am getting the maximum of a field from within these selected features. However, I would like to get maximum of a field from the whole table i.e., from both selected and un-selected features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how may I do it?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62108#M4971</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-04-26T12:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62109#M4972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'C:/Your_spaceless_path/CoordGeom.gdb/Polygons'&lt;/SPAN&gt;

arr &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; &lt;SPAN class="string token"&gt;'Shape_Area'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# pick a field&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# nan functions account for nulls, cast to the dtype of the field using astype &lt;/SPAN&gt;
np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;nanmax&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;astype&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'float'&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;155.0&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62109#M4972</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-10T22:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62110#M4973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, may be I was not clear. Your code gives same answer as mine. Let me try again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Imagine you have&amp;nbsp;3 features [0,1,2] in a fc. They have a income field which is an integer [10,12,14] respectively .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case1: I have selected no feature selected, I ask for max of fc , I get 14 &amp;gt;&amp;gt; correct&lt;/P&gt;&lt;P&gt;case2: I have selected features [0,1], i ask for max of fc , I get 12 &amp;gt;&amp;gt; incorrect, I still want 14, because I am asking max of fc, not max of selection of fc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;case3: I have selected features [1,2], i ask for max of fc, I get 14, &amp;gt;&amp;gt; correct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it clarifies a bit?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 13:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62110#M4973</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-04-26T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62111#M4974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I mean, I am asking max of income field in fc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 13:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62111#M4974</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-04-26T13:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62112#M4975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just need to ask: have&amp;nbsp;you actually looked at the values of your selected versus non-selected and done the summation manually?&amp;nbsp; Sounds like one of your fields is 0 or None value.&amp;nbsp; What is your objective of comparing your selected sum versus the non-selected?&amp;nbsp; If you know the sum of the income field without any selections, why not write that value to a variable if you need to make comparisons to it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 13:45:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62112#M4975</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-04-26T13:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62113#M4976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;User selects few features, sets their income to max(income in whole of&amp;nbsp; fc) +1 , so now the max of income of whole fc has changed. User goes to another area in the extent, selects a few polygons,&amp;nbsp;sets their income to max(income in whole of fc) + 1, so the max of income in the whole fc has changed again. This continues till all polygons are finished.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62113#M4976</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-04-26T14:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62114#M4977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My answer gives you the maximum whether you have a selection or not.&lt;/P&gt;&lt;P&gt;If you need that maximum, that is the way to get it without worrying about selections or not.&lt;/P&gt;&lt;P&gt;If you need maximum-ish (ie there is a selection) then work with arcpy&lt;/P&gt;&lt;P&gt;If you want the best of both worlds, they you can work with both approaches&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:45:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62114#M4977</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-26T14:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62115#M4978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;would your solution of accessing a disk file be affected by:&lt;/P&gt;&lt;P&gt;1. lock imposed by arcmap&lt;/P&gt;&lt;P&gt;2. hard-coded path on the file system?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 11:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62115#M4978</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-04-29T11:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62116#M4979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you see the requirements for the function, it just requires the path to the featureclass's table.&amp;nbsp; Locks aren't for reading, only modifying a featureclass.&lt;/P&gt;&lt;P&gt;You could try it and report back&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 12:21:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62116#M4979</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-29T12:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62117#M4980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dans Answer is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'C:/Your_spaceless_path/CoordGeom.gdb/Polygons'&lt;/SPAN&gt;

arr &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;TableToNumPyArray&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;in_fc&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Shape_Area'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit;"&gt;# pick a field&lt;/SPAN&gt;

&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit;"&gt;# nan functions account for nulls, cast to the dtype of the field using astype &lt;/SPAN&gt;
np&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;nanmax&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;arr&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;astype&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'float'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&amp;nbsp; 

&lt;SPAN class="" style="color: #990000; border: 0px; font-weight: inherit;"&gt;155.0&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If this is returning different numbers based on selection, then this is because you are not entering "in_fc" as shwon above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'C:/Your_spaceless_path/CoordGeom.gdb/Polygons'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is different than:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;in_fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Polygons'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One points to a layer in a map, and will return results based on selections and things, the other points to data on a disk, and will return counts of whatever is inside that dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only possible thing that could go wrong using this, is if a user is inside an Edit session, then there features are not saved to the "dataset on disk" until they save Edits.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:21:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62117#M4980</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2021-12-10T22:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62118#M4981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use a Describe object to retrieve the underlying feature class of the feature layer.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;featlyr_name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"rangerdistrict"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# name of existing feature layer&lt;/SPAN&gt;
fld_max &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GIS_ACRES"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# field for determining maximum value&lt;/SPAN&gt;

max&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&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;featlyr_name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fld_max&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featlyr_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;featureclass&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;catalogPath
max&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&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;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fld_max&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:22:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62118#M4981</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-10T22:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy: maximum of a field of a feature class</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62119#M4982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ &lt;A href="https://community.esri.com/migrated-users/3420"&gt;Joshua Bixby&lt;/A&gt;‌ &lt;A href="https://community.esri.com/migrated-users/19140"&gt;Luke Webb&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did two different approaches and both worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Approach 1. I first got a max for the selection, then switched the selection and got a second max, then took max of the both. I felt it was slow, but it works and this switching also updated my labels in display, which kind of confirmed the display of new max assigned to the features.&lt;/P&gt;&lt;P&gt;Approach 2. I did not follow the advice of giving a&amp;nbsp; hard coded path, because user can have the&amp;nbsp;file&amp;nbsp;anywhere on the system. So instead, I used &lt;STRONG&gt;layer.dataSource&lt;/STRONG&gt; to get the path.&amp;nbsp;&amp;nbsp;Then I used &lt;STRONG&gt;np.amax&lt;/STRONG&gt; to get the max of the array (attribute table).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So broadly I followed the advice of path and the advice of np.array and&amp;nbsp;also liked the list comprehension technique by Joshua. that also works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 11:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-maximum-of-a-field-of-a-feature-class/m-p/62119#M4982</guid>
      <dc:creator>RamB</dc:creator>
      <dc:date>2019-05-01T11:28:05Z</dc:date>
    </item>
  </channel>
</rss>

