<?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: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043666#M60656</link>
    <description>&lt;P&gt;Is that - before the &lt;EM&gt;summed_total&lt;/EM&gt; in your actual script (-summed_total = ... )?&amp;nbsp; if it is, then the name 'summed_total' wouldn't exist.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Apr 2021 12:42:33 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-04-04T12:42:33Z</dc:date>
    <item>
      <title>How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374627#M29595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a feature class with two fields I am interested in using.&amp;nbsp; One field is "area_acres" and the other is "Survey_Pcnt".&amp;nbsp; I have calculated the field "area_acres".&amp;nbsp; My intent is to&amp;nbsp;sum all the values in the field "area_acres" and then use that&amp;nbsp;"summed_total" in the following expression to calculate the "Survey_Pcnt" field:&amp;nbsp; &lt;EM&gt;"!area_acres!/summed_total*100".&amp;nbsp;&amp;nbsp;&lt;/EM&gt;I have managed to sum all the values successfully, but when I try to add &lt;EM&gt;summed_total&lt;/EM&gt; as a variable in the expression and run the script I get the error:&amp;nbsp;&lt;EM&gt;TypeError: unsupported operand type(s) for /: 'str' and 'float'&lt;/EM&gt;.&amp;nbsp; This error leads me to believe I'm trying to perform division between a string and floating point which wouldn't work.&amp;nbsp; Below is my code that I'm having trouble with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;summed_total = sum((r[0] for r in arcpy.da.SearchCursor(env.workspace + "/APE_intersect_dissolve_adequacy", ['area_acres'])))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;print (summed_total)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;percentage_expression = "(float(!area_acres!))"/float(summed_total)*"(float(100))"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.CalculateField_management(env.workspace + "/APE_intersect_dissolve_adequacy","Survey_Pcnt", percentage_expression, "PYTHON_9.3")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried writing the percentage_expression many different ways to no avail.&amp;nbsp; At this point any help is greatly appreciated. Let me know if there is any other information I can provide.&amp;nbsp; I am using ArcGIS desktop 10.7.1 and arcpy.&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 17:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374627#M29595</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2020-08-13T17:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374628#M29596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John.&amp;nbsp; This would be a good question for the &lt;A href="https://community.esri.com/space/2145"&gt;Python&lt;/A&gt;‌ space!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 18:09:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374628#M29596</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2020-08-13T18:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374629#M29597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kory.&amp;nbsp; Can you tell me how to get it there?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 18:17:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374629#M29597</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2020-08-13T18:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374630#M29598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you moved it for me, thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 18:18:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374630#M29598</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2020-08-13T18:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374631#M29599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No worries.&amp;nbsp; Yeah, I figured the @mention would make it show up in that space so hopefully somebody there can help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 19:47:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374631#M29599</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2020-08-13T19:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374632#M29600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;e = float(&lt;STRONG style="background-color: #ffffff; border: 0px; font-weight: bold;"&gt;!area_acres!&lt;/STRONG&gt;)/float(summed_total) * float(100)&lt;/P&gt;&lt;P&gt;Will return a correct numeric value, now if the expression needs to be quoted, add the quotes to this.&amp;nbsp; You had too many&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 20:50:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374632#M29600</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-13T20:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374633#M29601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;thank you for your reply unfortunately&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;e = float(&lt;/SPAN&gt;&lt;STRONG style="background-color: #ffffff; border: 0px; font-weight: bold;"&gt;!area_acres!&lt;/STRONG&gt;&lt;SPAN style="background-color: #ffffff;"&gt;)/float(summed_total) * float(100) gives me a syntax error which I'm trying to resolve.&amp;nbsp; When I put double quotations around the whole expression, the variables become strings and the float command does not work.&amp;nbsp; I'll keep trying and responses are still welcome.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;John&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 22:08:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374633#M29601</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2020-08-13T22:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374634#M29602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe you have to emulate a codeblock and expression&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;exp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"do_stuff(!area_acres!, summed_total)"&lt;/SPAN&gt;
codeblock &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"""
def do_stuff(area, tot):
    return area/tot * 100"""&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:20:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374634#M29602</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-11T17:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374635#M29603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;That worked with the condition of adding a new field of the total area and calculating it first.&amp;nbsp; So all fields need to be created and populated before I can use the above code block.&amp;nbsp; I was interested in a method of using the sum of the areas without having to create a new field and populate it with area sums (that are the same value).&amp;nbsp; Otherwise it worked.&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2020 07:03:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/374635#M29603</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2020-10-08T07:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043638#M60649</link>
      <description>&lt;P&gt;I have a similar question and I tried to do the same as yours but my code is not working...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-fg"&gt;ExecuteError&lt;/SPAN&gt;: ERROR 000539: Traceback (most recent call last):
  File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
NameError: name 'summed_total' is not defined

Failed to execute (CalculateField).&lt;/PRE&gt;&lt;P&gt;-summed_total = sum((r[0] for r in arcpy.da.SearchCursor("summary_tract_2", ['Sum_tract'])))&lt;BR /&gt;print(summed_total)&lt;/P&gt;&lt;P&gt;per_exp = "my_percent(!Sum_tract!, summed_total)"&lt;/P&gt;&lt;P&gt;codeblock = """&lt;BR /&gt;def my_percent(area, tot):&lt;BR /&gt;return area/tot * 100"""&lt;/P&gt;&lt;P&gt;print(codeblock)&lt;BR /&gt;# Execute AddField&lt;BR /&gt;arcpy.AddField_management("summary_tract_2", "test", "SHORT")&lt;BR /&gt;&lt;BR /&gt;# Execute CalculateField&lt;BR /&gt;arcpy.CalculateField_management("summary_tract_2", "test",&lt;BR /&gt;per_exp, "PYTHON3", codeblock)&lt;/P&gt;&lt;P&gt;-----------&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 06:29:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043638#M60649</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-04T06:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043666#M60656</link>
      <description>&lt;P&gt;Is that - before the &lt;EM&gt;summed_total&lt;/EM&gt; in your actual script (-summed_total = ... )?&amp;nbsp; if it is, then the name 'summed_total' wouldn't exist.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 12:42:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043666#M60656</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-04T12:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043670#M60657</link>
      <description>&lt;P&gt;it was typos... not working even after removing this..&lt;/P&gt;&lt;P&gt;###Codes:&lt;/P&gt;&lt;P&gt;summed_total = sum((r[0] for r in arcpy.da.SearchCursor("summary_tract_2", ['Sum_tract'])))&lt;BR /&gt;print(summed_total)&lt;/P&gt;&lt;P&gt;# This part is working to get my percent (I manually included sumtotal in my exp)&lt;BR /&gt;per_exp = "(!sum_tract!/1836082531.0221872)*100"&lt;BR /&gt;arcpy.AddField_management("summary_tract_2", "test1", "SHORT")&lt;BR /&gt;arcpy.CalculateField_management("summary_tract_2", "test1", per_exp)&lt;/P&gt;&lt;P&gt;# This part is NOT working to get my percent (here sumtotal selected in the func)&lt;BR /&gt;per_exp = "my_percent(!Sum_tract!, summed_total)"&lt;BR /&gt;codeblock = """&lt;BR /&gt;def my_percent(area, tot):&lt;BR /&gt;return area/tot * 100"""&lt;BR /&gt;# Add Field &amp;amp; Calculate Field&lt;BR /&gt;arcpy.AddField_management("summary_tract_2", "test2", "SHORT")&lt;BR /&gt;arcpy.CalculateField_management("summary_tract_2", "test2",&lt;BR /&gt;per_exp, "PYTHON3", codeblock)&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 14:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043670#M60657</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-04T14:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043674#M60658</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;This part is NOT working&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It is helpful to elaborate when saying something isn't working because there are lots of ways something can be broken and not work.&amp;nbsp; Are you getting an error message?&amp;nbsp; If so, what, and include the traceback. Are you getting unexpected results?&amp;nbsp; If so, what do you expect and what are you getting?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 15:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043674#M60658</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-04-04T15:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043675#M60659</link>
      <description>&lt;P&gt;it says...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-fg"&gt;ExecuteError&lt;/SPAN&gt;: ERROR 000539: Traceback (most recent call last):
  File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
NameError: name 'sum_total' is not defined&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Apr 2021 15:30:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043675#M60659</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-04T15:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043679#M60660</link>
      <description>&lt;P&gt;I am a bit confused because all of your code uses "summed_total" but the error message references "sum_total".&amp;nbsp; Do you have both "summed_total" and "sum_total" variables?&amp;nbsp; If not, why is the error message referencing a different variable name than in your code snippet?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 16:11:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043679#M60660</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-04-04T16:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043687#M60663</link>
      <description>&lt;P&gt;summed_area = sum((r[0] for r in arcpy.da.SearchCursor("summary_eff_area", ['area'])))&lt;BR /&gt;print(summed_area)&lt;/P&gt;&lt;P&gt;per_exp = "my_percent(!area!, summed_area)"&lt;/P&gt;&lt;P&gt;codeblock = """&lt;BR /&gt;def my_percent(area, tot):&lt;BR /&gt;return area/tot * 100"""&lt;/P&gt;&lt;P&gt;# CalculateField&lt;BR /&gt;arcpy.CalculateField_management("summary_eff_area", "percent",&lt;BR /&gt;per_exp, "PYTHON3", codeblock)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-fg"&gt;ExecuteError&lt;/SPAN&gt;: ERROR 000539: Traceback (most recent call last):
  File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
NameError: name 'summed_area' is not defined&lt;BR /&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 16:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043687#M60663</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-04T16:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043695#M60664</link>
      <description>&lt;P&gt;got it done!! by another approach...&lt;/P&gt;&lt;P&gt;To calculate percentage: area to percent&lt;/P&gt;&lt;P&gt;total = float(sum(row[0] for row in arcpy.da.SearchCursor("summary_eff_area", 'area')))&lt;BR /&gt;print(total)&lt;BR /&gt;with arcpy.da.UpdateCursor("summary_eff_area", ('area', 'percent')) as uCursor:&lt;BR /&gt;for area, percent in uCursor:&lt;BR /&gt;uCursor.updateRow([area, (area / total)*100])&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 16:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043695#M60664</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-04T16:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043698#M60665</link>
      <description>&lt;P&gt;I am glad you got it working with an update cursor.&amp;nbsp; I mocked up some similar code as yours and ran it in the interactive Python window with no issues using Pro 2.7, so maybe it is either something related the version you are using or how or where you are calling the code from.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 17:49:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1043698#M60665</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-04-04T17:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1044026#M60680</link>
      <description>Thanks... could you please share your code to compare line by line ...&lt;BR /&gt;in my case even sometimes same code do stop working..&lt;BR /&gt;&lt;BR /&gt;Bibhash&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Apr 2021 23:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1044026#M60680</guid>
      <dc:creator>BibhashNath</dc:creator>
      <dc:date>2021-04-05T23:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set up an expression in arcpy to calculate percent where one of the variables is the result of a previous calculation</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1044240#M60695</link>
      <description>&lt;P&gt;I basically just copied your code and updated the field names.&amp;nbsp; I was running it in the interactive Python window in Pro, is that where you are running the code from?&lt;/P&gt;&lt;P&gt;Regarding:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;in my case even sometimes same code do stop working.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If your code sometimes works and sometimes doesn't, than the issue likely isn't your code and something else because valid code is valid code.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 17:29:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-up-an-expression-in-arcpy-to-calculate/m-p/1044240#M60695</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-04-06T17:29:47Z</dc:date>
    </item>
  </channel>
</rss>

