<?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: Python Tool Box in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285894#M68792</link>
    <description>&lt;P&gt;Guess I overthough that one a bit.&amp;nbsp; No need for the split if you are always grabbing the last 6 digits:&lt;/P&gt;&lt;P&gt;Calc tool, Expression Type Python 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;!GEOIDFIELD![-6:]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2023 21:02:20 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2023-05-04T21:02:20Z</dc:date>
    <item>
      <title>Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285832#M68783</link>
      <description>&lt;P&gt;I'm new to python. What tool would I use to --&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Take a (TEXT) GEO_ID 25027704202&lt;/LI&gt;&lt;LI&gt;Remove the ST (25) &amp;amp; COUNTY FIPS (027)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;so that I may use the calculate tool to establish a new field (TRACT) and populate 704202 into the new (TEXT) field I create for calculation please? I want to be like all the popular analysts online ; -)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 19:19:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285832#M68783</guid>
      <dc:creator>EricG</dc:creator>
      <dc:date>2023-05-04T19:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285878#M68788</link>
      <description>&lt;P&gt;Are all of them following the same format?&amp;nbsp; GEO_ID + space + 11 digits?&lt;/P&gt;&lt;P&gt;If so:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;intext = 'GEO_ID 25027704202'
intext.split(' ')[-1][-6:]
'704202'&lt;/LI-CODE&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 20:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285878#M68788</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-05-04T20:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285885#M68790</link>
      <description>&lt;P&gt;Hi EricG,&lt;/P&gt;&lt;P&gt;It depends on the context.&amp;nbsp; I think what you are saying is that you have a dataset that has a geoid field and want to do this:&lt;/P&gt;&lt;P&gt;-- Add a TRACT field to the dataset.&lt;BR /&gt;-- Set the tract field to the last 6 characters of the geoid.&lt;/P&gt;&lt;P&gt;Again without more context, it's difficult to guide you on the details, but assuming you're talking about a field in a dataset that is iterable with a cursor, you could do something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.workspace = "C:/mydatapath.gdb" # modify to reflect your workspace
theData = "/mydata" # modify to dataset with a geo_id column
theGEOIDfield = "GEOID" # modify to geo id column name

arcpy.management.AddField(theData, "TRACT", "TEXT")
with arcpy.da.UpdateCursor(theData, [theGEOIDfield, "TRACT"]) as uc:
    for row in uc:
        row[1] = row[0][-6:] # Set TRACT to the last 6 digits of the GEOID.
        uc.updateRow(row)    # Commit the change.
del uc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 20:31:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285885#M68790</guid>
      <dc:creator>LauraTateosian</dc:creator>
      <dc:date>2023-05-04T20:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285894#M68792</link>
      <description>&lt;P&gt;Guess I overthough that one a bit.&amp;nbsp; No need for the split if you are always grabbing the last 6 digits:&lt;/P&gt;&lt;P&gt;Calc tool, Expression Type Python 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;!GEOIDFIELD![-6:]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 21:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285894#M68792</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-05-04T21:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285956#M68801</link>
      <description>&lt;P&gt;I've placed a pic to gain more insight. &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/15530"&gt;@RhettZufelt&lt;/a&gt;, I've included you as well to respond to both of you.&lt;/P&gt;&lt;P&gt;I have the GEO_ID, and would like to keep the GEO_ID intact, but, would like to take the last digits associated with the TRACT and duplicate it into another field called TRACT. Is this helpful?&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 23:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285956#M68801</guid>
      <dc:creator>EricGurney</dc:creator>
      <dc:date>2023-05-04T23:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285958#M68802</link>
      <description>&lt;P&gt;I had a feeling it might not be too complicated. Is there a web resource I can learn more from about these things?&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 23:44:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285958#M68802</guid>
      <dc:creator>EricGurney</dc:creator>
      <dc:date>2023-05-04T23:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285964#M68803</link>
      <description>&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/15530"&gt;@RhettZufelt&lt;/a&gt;&lt;/P&gt;&lt;PRE&gt;!GEOIDFIELD![-6:]&lt;/PRE&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Worked like a charm. So would !GEOIDFIELD! [+6] have deleted from the right side of the number string? I'd really enjoy reading a link of some of the simpler python processes. But, just don't know what's best to review. Thank you and Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/134677"&gt;@LauraTateosian&lt;/a&gt;&amp;nbsp;for taking the time out to reply!&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 May 2023 00:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1285964#M68803</guid>
      <dc:creator>EricGurney</dc:creator>
      <dc:date>2023-05-05T00:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Python Tool Box</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1286126#M68826</link>
      <description>&lt;P&gt;This is refered to as &lt;A href="https://stackoverflow.com/questions/509211/how-slicing-in-python-works" target="_self"&gt;slicing&lt;/A&gt; in &lt;A href="https://www.tutorialspoint.com/difference-between-indexing-and-slicing-in-python" target="_self"&gt;python&lt;/A&gt;, and is not really deleting values, rather 'grabbing' values from the string.&lt;/P&gt;&lt;P&gt;many ways to do it, and the links I provide gives some good examples, but google has tons of into on it.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;!GEOIDFIELD![:6] would grab the first 6 digits.&lt;/P&gt;&lt;P&gt;!GEOIDFIELD![6:] skip first 6 digits and grab the rest.&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 14:43:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-tool-box/m-p/1286126#M68826</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-05-05T14:43:15Z</dc:date>
    </item>
  </channel>
</rss>

