<?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: Need help with python code for ArcMap Field Calculator in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485642#M70753</link>
    <description>&lt;P&gt;Thanks Esteban I will definitely check that out! One more thing, I noticed that after I entered that last python script sometimes it would move things other than the numbers. For 90% of them it worked but for some it switched things like Steam Mill Ferry Road 1231 to Road 1231 Steam Mill Ferry Road instead of 1231 Steam Mill Ferry Road. Is there a way I could enter something that would just move the word Road to the end, and I could switch that out after that works with Cove, Circle, Street, etc.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2024 19:46:06 GMT</pubDate>
    <dc:creator>EGardner7</dc:creator>
    <dc:date>2024-06-05T19:46:06Z</dc:date>
    <item>
      <title>Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485368#M70747</link>
      <description>&lt;P&gt;I am attempting to use python to change values in a field named CableName. I am trying to change the capitalization for the first word/words in the field to only the first letter capitalized. For example&amp;nbsp;PRESTON Avenue 420 to Preston Avenue 420. Or N HIGHLAND Avenue 519 to N Highland Avenue 519. I am trying to just focus on the values that contain the word Avenue so I can exclude any variation and then I will replace Avenue with Street, Cove, Road, etc. I've tried to use copilot and I have had some success with other scripts but this one is giving me some trouble. Here are some scripts that have worked for me in the past:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;!CableName! .replace("St.", "Street")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;!LegacyName! if !CableName! is None else !CableName!&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get Copilot to write this in a similar format but here is what it gives me:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;def&lt;/SPAN&gt; &lt;SPAN class=""&gt;capitalize_first_letter&lt;/SPAN&gt;(&lt;SPAN class=""&gt;word&lt;/SPAN&gt;):
    &lt;SPAN class=""&gt;# Check if the word is in all caps&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; word.isupper():
        &lt;SPAN class=""&gt;# Capitalize the first letter and make the rest lowercase&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; word.capitalize()
    &lt;SPAN class=""&gt;else&lt;/SPAN&gt;:
        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; word

&lt;SPAN class=""&gt;# Usage example:&lt;/SPAN&gt;
&lt;SPAN class=""&gt;# Call the function with the field value&lt;/SPAN&gt;
result = capitalize_first_letter(!CableName!)
result&lt;/PRE&gt;&lt;P&gt;I am new to using Python but if I could get this to work it would save me months of work. Would really appreciate any help with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:18:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485368#M70747</guid>
      <dc:creator>EGardner7</dc:creator>
      <dc:date>2024-06-05T14:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485374#M70748</link>
      <description>&lt;P&gt;Have you tried this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;!CableName!.title()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485374#M70748</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2024-06-05T14:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485381#M70749</link>
      <description>&lt;P&gt;Wow I didn't realize I could do it all at once! I was able to update over 24,000 records so I really appreciate your help. Would you possibly know how I could move numbers from the end of a field to the front? For example Stratford Lane 215 to 215 Stratford Lane or Gordon Street 237-R to 237-R Gordon Street.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:36:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485381#M70749</guid>
      <dc:creator>EGardner7</dc:creator>
      <dc:date>2024-06-05T14:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485545#M70750</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/774670"&gt;@EGardner7&lt;/a&gt;&amp;nbsp;for your last question you can try this code, works fine for your examples. This code move the last part of your address to the front of your address. Move always the last part&amp;nbsp;regardless of whether they are numbers or letters.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;' '.join([!YourAddressField!.split()[-1]]+!YourAddressField!.split()[:-1])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- Regards!, Esteban Marcelloni&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Image 1: I convert Provincia to Departamento&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imagen.png" style="width: 836px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106274iD7CFA12C13594433/image-size/large?v=v2&amp;amp;px=999" role="button" title="imagen.png" alt="imagen.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 17:31:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485545#M70750</guid>
      <dc:creator>emarcelloni</dc:creator>
      <dc:date>2024-06-05T17:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485589#M70751</link>
      <description>&lt;P&gt;Thank you Esteban! That is amazing. Do you have any tips for learning how to use python? This is all new to me, so I would love to learn what else I could do with it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 18:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485589#M70751</guid>
      <dc:creator>EGardner7</dc:creator>
      <dc:date>2024-06-05T18:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485629#M70752</link>
      <description>&lt;P&gt;I learnt a lot from here:&amp;nbsp;&lt;A href="https://www.kaggle.com/learn" target="_blank"&gt;https://www.kaggle.com/learn&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the learn section you have shorts and dinamics Courses. This site is for people who wants to learn DataScience and MachineLearning but in the process you will learn a lot of Python. I recommend you to do all the Courses starting from here:&amp;nbsp;&lt;A href="https://www.kaggle.com/learn/python" target="_blank"&gt;https://www.kaggle.com/learn/python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards! Esteban Marcelloni&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 19:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485629#M70752</guid>
      <dc:creator>emarcelloni</dc:creator>
      <dc:date>2024-06-05T19:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485642#M70753</link>
      <description>&lt;P&gt;Thanks Esteban I will definitely check that out! One more thing, I noticed that after I entered that last python script sometimes it would move things other than the numbers. For 90% of them it worked but for some it switched things like Steam Mill Ferry Road 1231 to Road 1231 Steam Mill Ferry Road instead of 1231 Steam Mill Ferry Road. Is there a way I could enter something that would just move the word Road to the end, and I could switch that out after that works with Cove, Circle, Street, etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 19:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485642#M70753</guid>
      <dc:creator>EGardner7</dc:creator>
      <dc:date>2024-06-05T19:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with python code for ArcMap Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485743#M70754</link>
      <description>&lt;P&gt;I always try things in the Python window before I actually run it in the field calculator.&lt;/P&gt;&lt;P&gt;I got this to work-&lt;/P&gt;&lt;LI-CODE lang="c"&gt;' '.join([!FieldName!.split()[-1], ' '.join(!FieldName!.split()[:-1])])&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Jun 2024 22:19:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-with-python-code-for-arcmap-field/m-p/1485743#M70754</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2024-06-05T22:19:31Z</dc:date>
    </item>
  </channel>
</rss>

