<?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: Simple Python label expression FAIL! in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596223#M73929</link>
    <description>&lt;P&gt;It can be simplified a bit more even.&amp;nbsp; The [PtZ] doesn't have to be stored in a separate variable, it is already a variable:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([PtZ]):
    return [PtZ].split('.')[1]&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 17 Mar 2025 17:17:11 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2025-03-17T17:17:11Z</dc:date>
    <item>
      <title>Simple Python label expression FAIL!</title>
      <link>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596194#M73927</link>
      <description>&lt;P&gt;In the python window, this works as expected:&lt;/P&gt;&lt;P&gt;n = 1313.87&lt;BR /&gt;type(n)&lt;BR /&gt;&amp;lt;class 'float'&amp;gt;&lt;BR /&gt;str(n).split('.')[1]&lt;BR /&gt;'87'&lt;/P&gt;&lt;P&gt;HOWEVER, trying to do the same to label features fails:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KevinBell1_0-1742229637894.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128056i3EC64F7DD59B959F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KevinBell1_0-1742229637894.png" alt="KevinBell1_0-1742229637894.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note that PtZ is a Double, and the label expression str([PtZ]) labels just fine.&lt;/P&gt;&lt;P&gt;What am I doing wrong here???&lt;/P&gt;&lt;P&gt;Pro version 3.4&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 16:44:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596194#M73927</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2025-03-17T16:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python label expression FAIL!</title>
      <link>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596213#M73928</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/273218"&gt;@KevinBell1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like when using the label expressions, it's placing a "return" in front of the expression. This normally means you will need to create a function for this, with set return values, something like this here:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([PtZ]):
    val = str([PtZ])
    parts = val.split('.')
    if len(parts) &amp;gt; 1:
        return parts[1]
    else:
        return ''&lt;/LI-CODE&gt;&lt;P&gt;Let me know if this ends up working for you!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 17:08:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596213#M73928</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-03-17T17:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python label expression FAIL!</title>
      <link>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596223#M73929</link>
      <description>&lt;P&gt;It can be simplified a bit more even.&amp;nbsp; The [PtZ] doesn't have to be stored in a separate variable, it is already a variable:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([PtZ]):
    return [PtZ].split('.')[1]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Mar 2025 17:17:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1596223#M73929</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-03-17T17:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python label expression FAIL!</title>
      <link>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1599593#M73962</link>
      <description>&lt;P&gt;Great!&amp;nbsp; That works, but is some weird ESRI stuff going on since you can't split a float/double!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 18:19:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/simple-python-label-expression-fail/m-p/1599593#M73962</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2025-03-26T18:19:06Z</dc:date>
    </item>
  </channel>
</rss>

