<?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: Separate Numeric Part of Record into Separate Field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1692021#M75171</link>
    <description>&lt;P&gt;Hi Dan, when I entered the code as you wrote it, it works. But when I enter the field name, I get and error.&amp;nbsp; If my field name is "Notes" do I enter the expression as:&lt;/P&gt;&lt;P&gt;float(!Notes!.split("$")[-1].replace(",",""))&lt;/P&gt;</description>
    <pubDate>Mon, 23 Mar 2026 17:54:01 GMT</pubDate>
    <dc:creator>MeKohler</dc:creator>
    <dc:date>2026-03-23T17:54:01Z</dc:date>
    <item>
      <title>Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691722#M75165</link>
      <description>&lt;P&gt;Hi, I have a text string "1.03 ac @@ $2,246/ac = &lt;STRONG&gt;2,253.29"&lt;/STRONG&gt; and would like to separate out the bold portion into a separate field. Can I do this in field calculator?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Michael Kohler&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2026 15:38:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691722#M75165</guid>
      <dc:creator>MeKohler</dc:creator>
      <dc:date>2026-03-20T15:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691734#M75166</link>
      <description>&lt;P&gt;s = "1.03 ac @@ $2,246/ac = 2,253.29"&lt;/P&gt;&lt;P&gt;float(s.split(" ")[-1].replace(",",""))&lt;/P&gt;&lt;LI-CODE lang="python"&gt;s = "1.03 ac @@ $2,246/ac = 2,253.29"
float(s.split(" ")[-1].replace(",",""))
2253.29
#
# shorter number
s = "1.03 ac @@ $2,246/ac = 253.29"
float(s.split(" ")[-1].replace(",",""))
253.29&lt;/LI-CODE&gt;&lt;P&gt;assuming the number is always the last and the number is comma delimited.&lt;/P&gt;&lt;P&gt;'s' is your field name of course&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2026 16:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691734#M75166</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2026-03-20T16:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691748#M75167</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2026 16:56:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691748#M75167</guid>
      <dc:creator>MeKohler</dc:creator>
      <dc:date>2026-03-20T16:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691787#M75168</link>
      <description>&lt;P&gt;The following is possibly overkill for your situation, but regular expression is the hammer I like to use on everything like a nail. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The following uses regex to extract all three numerical values in the text string, and then return one of them based on how the custom function is called.&amp;nbsp; If the string field is NULL then NULL is returned.&lt;BR /&gt;&lt;BR /&gt;Expression Type:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;PYTHON3&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Expression:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;extract_value(!text_field!, "total")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Code Block:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import re

pattern = re.compile(
    r"(?P&amp;lt;acre&amp;gt;[\d,.]+)\s*ac\s*@@\s*\$"
    r"(?P&amp;lt;price&amp;gt;[\d,.]+)/ac\s*=\s*"
    r"(?P&amp;lt;total&amp;gt;[\d,.]+)"
)

def extract_value(field, value):
    if field is not None:
        match = re.search(pattern, field)
        return match.groupdict()[value]&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Mar 2026 19:27:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1691787#M75168</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2026-03-20T19:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1692021#M75171</link>
      <description>&lt;P&gt;Hi Dan, when I entered the code as you wrote it, it works. But when I enter the field name, I get and error.&amp;nbsp; If my field name is "Notes" do I enter the expression as:&lt;/P&gt;&lt;P&gt;float(!Notes!.split("$")[-1].replace(",",""))&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2026 17:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1692021#M75171</guid>
      <dc:creator>MeKohler</dc:creator>
      <dc:date>2026-03-23T17:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Numeric Part of Record into Separate Field</title>
      <link>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1692043#M75172</link>
      <description>&lt;P&gt;destination field needs to be "double" aka float&lt;/P&gt;&lt;P&gt;source field is text&amp;nbsp; see attached since I can't insert the image here for some reason&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2026 19:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/separate-numeric-part-of-record-into-separate/m-p/1692043#M75172</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2026-03-23T19:18:08Z</dc:date>
    </item>
  </channel>
</rss>

