<?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: Using update cursor with dictionary keys/values fails in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484974#M37855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can it be assumed the 'ZipCode' field is text and will not be None, null, blank?&amp;nbsp; If not, you will need to do some checking before line 12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in line 12, looks like you are asking for the first element, but the dictionary value in the example isn't a list / tuple.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2019 23:33:59 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2019-08-28T23:33:59Z</dc:date>
    <item>
      <title>Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484973#M37854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've used &lt;A href="https://community.esri.com/migrated-users/4811" target="_blank"&gt;Richard Fairhurst&lt;/A&gt;‌'s &lt;A _jive_internal="true" href="https://community.esri.com/blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries" target="_blank"&gt;TurboCharging&lt;/A&gt; method on numerous occasions and today for some unknown reason I'm getting an error I've never seen:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TypeError: 'int' object is not subscriptable&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I'm not sure what I've done wrong:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'DeliveryData_2018'&lt;/SPAN&gt;
updateFields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Zipcode'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ClientCount'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

edit &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Editor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ws&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startEditing&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startOperation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        
&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;updateFields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; updateRows&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; updateRow &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; updateRows&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
       keyValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; updateRow&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
       &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; keyValue &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; countDict2018&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
           updateRow&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; countDict2018&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;keyValue&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
           updateRows&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopOperation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopEditing&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="string token"&gt;'''
countDict2018 is in the form of:

{'84006': 3,'84009': 14,'84020': 37,...}

'''&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;/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;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;/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;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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to check for the value&amp;nbsp;in&amp;nbsp; line 12 as my zipcode polygons have a few zipcodes that I don't serve; without that, it chokes on a zipcode value in the polygon fc that does not appear in the dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(End of the day blues...)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484973#M37854</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T21:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484974#M37855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can it be assumed the 'ZipCode' field is text and will not be None, null, blank?&amp;nbsp; If not, you will need to do some checking before line 12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in line 12, looks like you are asking for the first element, but the dictionary value in the example isn't a list / tuple.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 23:33:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484974#M37855</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-08-28T23:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484975#M37856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Randy-&amp;nbsp; I will check the feature class for null values: yes they are text type.&amp;nbsp; I think the idea with that polygon fc was to be able to use zip+4 so it would have a '-' in it. That data pre-dates me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I grabbed another script of mine from the archives that used the same line 12 and 13 but I can't remember what the dictionary looked like.&amp;nbsp; Maybe something like this would correct it:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;keyValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; updateRow&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
       &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; keyValue &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; countDict2018&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
           dictValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; countDict2018&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;keyValue&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
           updateRow&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dictValue
           updateRows&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;)&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fresh start (and eyes) in the morning...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:22:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484975#M37856</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T21:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484976#M37857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;'int' object is not subscriptable&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# ---- you think there is more than 1, but there isn't&lt;/SPAN&gt;

a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;

a&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- do the slicy thing&lt;/SPAN&gt;
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

  File &lt;SPAN class="string token"&gt;"&amp;lt;ipython-input-2-6a1284577a36&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    a&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

TypeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'int'&lt;/SPAN&gt; object &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; subscriptable


&lt;SPAN class="comment token"&gt;# ---- you need to check that a list, tuple whatever-iterable&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# has more than one value and correct for it&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; isinstance&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; float&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- do a check for non-iterable&lt;/SPAN&gt;
    a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;                      &lt;SPAN class="comment token"&gt;# ---- make it an iterable of one&lt;/SPAN&gt;
    

a&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- now do the slicing&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- on to the next problem&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;/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;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;/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;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;/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 21:22:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484976#M37857</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T21:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484977#M37858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Knowing my dictionary is a single value per key, I went with:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;dictValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; countDict2018&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;keyValue&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 14:19:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484977#M37858</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-08-29T14:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484978#M37859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You say that:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;countDict2018 is in the form of:

{'84006': 3,'84009': 14,'84020': 37,...}
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That means an example of the key is '84006' and an example of the value is 3.&amp;nbsp; So the value is an integer and all you need to do to access it is use: countDict2018[&lt;SPAN&gt;'84006'].&amp;nbsp; You&amp;nbsp;only add an index value like&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;countDict2018[&lt;/SPAN&gt;&lt;SPAN&gt;'84006'][0] when the dictionary&amp;nbsp;&lt;/SPAN&gt;value contains a list or tuple (which was assumed in my sample blog code since I was normally storing values in the dictionary from multiple fields).&amp;nbsp; So&amp;nbsp;the code you wrote would only work&amp;nbsp; if:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;countDict2018 is in the form of:

{'84006': [3],'84009': [14],'84020': [37],...}

or
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;countDict2018 is in the form of:

{'84006': (3),'84009': (14),'84020': (37),...}&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:22:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484978#M37859</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T21:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using update cursor with dictionary keys/values fails</title>
      <link>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484979#M37860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even better.&amp;nbsp; Thanks RIchard!&amp;nbsp; ( and thanks for your methodology)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 14:55:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-update-cursor-with-dictionary-keys-values/m-p/484979#M37860</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-08-29T14:55:59Z</dc:date>
    </item>
  </channel>
</rss>

