<?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 Excluding the value 0 with the Python function MinimumValue in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365728#M76886</link>
    <description>&lt;P&gt;Trying to get the minimum value of a list of numeric records excluding the value 0. I found an example in StackExchange that looks something like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;fieldX = min (filter (not_0, [!field1!, !field2!, !field3!, !field!]))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def not_0 (value):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Return value &amp;gt; 0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Tried in Pro, like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;fieldX = MinimumValue(filter(not_0, [!field1!, !field2!, !field3!, !field!]))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def not_0 (value):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return value &amp;gt; 0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But it doesn’t work because in the code block it’s an “invalid expression. No function was found with the name ‘MinimumValue’”.&lt;/P&gt;&lt;P&gt;I am not sure if it is because of the function filter or the script itself that causes the error.&lt;/P&gt;&lt;P&gt;Any idea on how to exclude the value 0 while still getting the minimum value? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 13:16:18 GMT</pubDate>
    <dc:creator>RudyJamet</dc:creator>
    <dc:date>2024-01-03T13:16:18Z</dc:date>
    <item>
      <title>Excluding the value 0 with the Python function MinimumValue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365728#M76886</link>
      <description>&lt;P&gt;Trying to get the minimum value of a list of numeric records excluding the value 0. I found an example in StackExchange that looks something like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;fieldX = min (filter (not_0, [!field1!, !field2!, !field3!, !field!]))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def not_0 (value):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Return value &amp;gt; 0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Tried in Pro, like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;fieldX = MinimumValue(filter(not_0, [!field1!, !field2!, !field3!, !field!]))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def not_0 (value):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return value &amp;gt; 0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But it doesn’t work because in the code block it’s an “invalid expression. No function was found with the name ‘MinimumValue’”.&lt;/P&gt;&lt;P&gt;I am not sure if it is because of the function filter or the script itself that causes the error.&lt;/P&gt;&lt;P&gt;Any idea on how to exclude the value 0 while still getting the minimum value? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 13:16:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365728#M76886</guid>
      <dc:creator>RudyJamet</dc:creator>
      <dc:date>2024-01-03T13:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding the value 0 with the Python function MinimumValue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365749#M76887</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/594424"&gt;@RudyJamet&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was curious if you've attempted the use of min() as well? I believe that MinimumValue is a custom function that is not recognized in Python as it uses min() instead. This has worked with my testing using fieldX = min (filter (not_0, [!field1!, !field2!, !field3!, !field!])), if you're comfortable with lambda functions as well, you could attempt this too, which would eliminate the need to use not_0: min(filter(lambda x: x &amp;gt; 0, [!field1!, !field2!, !field3!, !field!])).&lt;/P&gt;&lt;P&gt;If this doesn't work, let me know and I can check it out!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 13:39:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365749#M76887</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-01-03T13:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding the value 0 with the Python function MinimumValue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365774#M76891</link>
      <description>&lt;P&gt;I used the lambda function in the expression and it worked perfectly.&lt;/P&gt;&lt;P&gt;Thanks Cody, and happy new year!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 15:01:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365774#M76891</guid>
      <dc:creator>RudyJamet</dc:creator>
      <dc:date>2024-01-03T15:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding the value 0 with the Python function MinimumValue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365776#M76893</link>
      <description>&lt;P&gt;Great to hear, glad it helped! Happy New Year!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 15:03:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/excluding-the-value-0-with-the-python-function/m-p/1365776#M76893</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-01-03T15:03:07Z</dc:date>
    </item>
  </channel>
</rss>

