<?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: UpdateCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344555#M69102</link>
    <description>&lt;P&gt;Please put your code in code blocks (click on Post options, choose "Edit post (or reply)", hit the "..." in the top-right of the editor menu (to expand the menu block), copy the code text, then click on "&amp;lt;/&amp;gt;" and paste into the popup, then clean up the code inside and outside the code block). This will make your code legible.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2023 15:37:34 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2023-11-03T15:37:34Z</dc:date>
    <item>
      <title>UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344303#M69094</link>
      <description>&lt;P&gt;I am trying to update my attribute field based on a dictionary (join_count_dict) containing {FID:Join_Count}, (eg. {0:1,2:3,3:0,...}&lt;BR /&gt;The shapefile has an equal amount of FID as the dictionary, my script works occassionally, any suggestions?&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(shapefile, ['FID','Join_Count']) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;for row in cursor:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FID=row[0]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if FID in join_count_dict:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row[0] += join_count_dict[fid]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 10:42:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344303#M69094</guid>
      <dc:creator>stewart</dc:creator>
      <dc:date>2023-11-01T10:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344314#M69095</link>
      <description>&lt;P&gt;should it rather be&amp;nbsp;&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(shapefile, ['FID','Join_Count']) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;for row in cursor:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FID=row[0]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if FID in join_count_dict:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row[1] += join_count_dict[fid]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row[1] = -1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cursor.updateRow(row)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cursor.updateRow(row)&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 11:33:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344314#M69095</guid>
      <dc:creator>stewart</dc:creator>
      <dc:date>2023-11-01T11:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344477#M69097</link>
      <description>&lt;P&gt;This should technically work, but you have an extra line calling updateRow() that should be removed. I don't know if the logic is what you want to happen though. Can you clarify exactly what happens when it doesn't work? Is there an error message?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 15:57:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344477#M69097</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2023-11-01T15:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344555#M69102</link>
      <description>&lt;P&gt;Please put your code in code blocks (click on Post options, choose "Edit post (or reply)", hit the "..." in the top-right of the editor menu (to expand the menu block), copy the code text, then click on "&amp;lt;/&amp;gt;" and paste into the popup, then clean up the code inside and outside the code block). This will make your code legible.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 15:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1344555#M69102</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2023-11-03T15:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1345484#M69131</link>
      <description>&lt;P&gt;There is something else that was ruining it, the extra line is due my poor abilities on posting here. Thanks for the attention though, much appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 12:38:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1345484#M69131</guid>
      <dc:creator>stewart</dc:creator>
      <dc:date>2023-11-03T12:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor/m-p/1345917#M69157</link>
      <description>&lt;P&gt;Is fid declared anywhere?&amp;nbsp; I see FID, but python is case sensitive so what is fid in join_count_dict[fid]?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Nov 2023 12:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor/m-p/1345917#M69157</guid>
      <dc:creator>StaticK</dc:creator>
      <dc:date>2023-11-05T12:46:58Z</dc:date>
    </item>
  </channel>
</rss>

