<?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: Calculate Field (reclassifying numeric to numeric) Python code not working in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664734#M100028</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/951204"&gt;@RachelHough&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the only issue really is that when you're entering the function in the calculate field, it should be something like reclass(!BusTypeNumeric!) like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CodyPatterson_0-1762806863554.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143543i597D90164F51E1AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CodyPatterson_0-1762806863554.png" alt="CodyPatterson_0-1762806863554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You may also want to try and check for the integer rather than the string '1' would be a string, something like this, just depends on if they are Text or not, I'd try both:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(BusTypeNumeric):
    if BusTypeNumeric == 1:
        return 1
    elif BusTypeNumeric == 2:
        return 1
    elif BusTypeNumeric == 3:
        return 2
    elif BusTypeNumeric == 4:
        return 2
    elif BusTypeNumeric == 5:
        return 3&lt;/LI-CODE&gt;&lt;P&gt;The difference between = and == is a single = is for assignment, so test = 1, and the == is for an equivalency check, so if test == 1 which it does then it passes the if statement, in Python you can also leave out the parenthesis around the conditions!&lt;/P&gt;&lt;P&gt;Let me know if that helps!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
    <pubDate>Mon, 10 Nov 2025 20:37:54 GMT</pubDate>
    <dc:creator>CodyPatterson</dc:creator>
    <dc:date>2025-11-10T20:37:54Z</dc:date>
    <item>
      <title>Calculate Field (reclassifying numeric to numeric) Python code not working</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664731#M100027</link>
      <description>&lt;P&gt;I'm fairly certain that this is a VERY simple issue but I cannot figure it out as I'm a beginner. I'm trying to use a Python code to populate a new field in the attribute table based on values in another. I've added a new numeric field called BusTypeNumeric2 and would like to reclassify the existing numeric field BusTypeNumeric to populate it. BusTypeNumeric ranges from 1 to 5, and I would like to reclassify so that 1=1, 2=1, 3=2, 4=2, and 5=3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My expression(?) is:&lt;/P&gt;&lt;P&gt;BusTypeNumeric2=reclass(!BusTypeNumeric!)&lt;/P&gt;&lt;P&gt;The code block is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(BusTypeNumeric):
    if (BusTypeNumeric == '1'):
        return '1'
    elif (BusTypeNumeric == '2'):
        return '1'
    elif (BusTypeNumeric == '3'):
        return '2'
    elif (BusTypeNumeric == '4'):
        return '2'
    elif (BusTypeNumeric == '5'):
        return '3'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I verify the expression it comes back valid and when I run it it says that the operation was completed, but it doesn't change anything in the target field; BusTypeNumeric2 values are still all &amp;lt;Null&amp;gt; afterward. I've heard that if the fields are numeric, then you can use one = instead of two, but when I use one =, the code block comes up as invalid and I'm told to use two.&lt;/P&gt;&lt;P&gt;Any insight as to what I may be doing wrong? I'm happy to provide more information!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 20:29:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664731#M100027</guid>
      <dc:creator>RachelHough</dc:creator>
      <dc:date>2025-11-10T20:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field (reclassifying numeric to numeric) Python code not working</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664734#M100028</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/951204"&gt;@RachelHough&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the only issue really is that when you're entering the function in the calculate field, it should be something like reclass(!BusTypeNumeric!) like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CodyPatterson_0-1762806863554.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143543i597D90164F51E1AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CodyPatterson_0-1762806863554.png" alt="CodyPatterson_0-1762806863554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You may also want to try and check for the integer rather than the string '1' would be a string, something like this, just depends on if they are Text or not, I'd try both:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(BusTypeNumeric):
    if BusTypeNumeric == 1:
        return 1
    elif BusTypeNumeric == 2:
        return 1
    elif BusTypeNumeric == 3:
        return 2
    elif BusTypeNumeric == 4:
        return 2
    elif BusTypeNumeric == 5:
        return 3&lt;/LI-CODE&gt;&lt;P&gt;The difference between = and == is a single = is for assignment, so test = 1, and the == is for an equivalency check, so if test == 1 which it does then it passes the if statement, in Python you can also leave out the parenthesis around the conditions!&lt;/P&gt;&lt;P&gt;Let me know if that helps!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 20:37:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664734#M100028</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-11-10T20:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field (reclassifying numeric to numeric) Python code not working</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664737#M100029</link>
      <description>&lt;P&gt;Confirm you field types.&amp;nbsp; That is, the source field BusTypeNumeric, is it a text field or an integer type field?&lt;/P&gt;&lt;P&gt;The following shows the variants.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# -- checks for a text representation of the integer 1
BusTypeNumeric == '1'
# -- checks for the integer 1
BusTypeNumeric == 1&lt;/LI-CODE&gt;&lt;P&gt;The destination field can be either text or numeric, but you can't put '1' in a numeric field, it has to be 1&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 20:38:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664737#M100029</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-11-10T20:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field (reclassifying numeric to numeric) Python code not working</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664741#M100030</link>
      <description>&lt;P&gt;Thank you!!! All I had to do was remove the apostrophes from the numbers as you demonstrated. This is a bit confusing to me by since the single = didn't work; I thought that double = were used with text values, which led me to believe that the apostrophes needed to be used with values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 20:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664741#M100030</guid>
      <dc:creator>RachelHough</dc:creator>
      <dc:date>2025-11-10T20:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field (reclassifying numeric to numeric) Python code not working</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664745#M100031</link>
      <description>&lt;P&gt;In python&amp;nbsp; &amp;nbsp; =&amp;nbsp; &amp;nbsp;the assignment statement&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;==&amp;nbsp; &amp;nbsp;the equality check&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 20:48:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-reclassifying-numeric-to-numeric/m-p/1664745#M100031</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-11-10T20:48:50Z</dc:date>
    </item>
  </channel>
</rss>

