<?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 The row contains a bad value in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1049854#M60860</link>
    <description>&lt;P&gt;I have the following and I having a hard time by passing some blank attributes. I know what the problem is, the problem is that row Pin has blanks and when the codes tries to populate the Permits row it throws the 'The row contains a bad value' Error. It's trying to bunch all of 'P_num' that have a blank&amp;nbsp; into the Permits row. How can I get passed this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dict1 = dict()
with arcpy.da.SearchCursor(fc,['Pin','Perm_COUNT','P_Num']) as cursor:
    for row in cursor:
        if row not in (None, "", " "):
            dict1.setdefault(row[0],[]).append(str(row[2]))
            #print (dict1)

with arcpy.da.UpdateCursor(fc,['Pin','Perm_COUNT','Permits']) as cursor:
    for row in cursor:          
        row[2] = ",".join(dict1[row[0]])
        #print (",".join(dict1[row[0]]))
        cursor.updateRow(row)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 21 Apr 2021 22:07:57 GMT</pubDate>
    <dc:creator>2Quiker</dc:creator>
    <dc:date>2021-04-21T22:07:57Z</dc:date>
    <item>
      <title>The row contains a bad value</title>
      <link>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1049854#M60860</link>
      <description>&lt;P&gt;I have the following and I having a hard time by passing some blank attributes. I know what the problem is, the problem is that row Pin has blanks and when the codes tries to populate the Permits row it throws the 'The row contains a bad value' Error. It's trying to bunch all of 'P_num' that have a blank&amp;nbsp; into the Permits row. How can I get passed this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dict1 = dict()
with arcpy.da.SearchCursor(fc,['Pin','Perm_COUNT','P_Num']) as cursor:
    for row in cursor:
        if row not in (None, "", " "):
            dict1.setdefault(row[0],[]).append(str(row[2]))
            #print (dict1)

with arcpy.da.UpdateCursor(fc,['Pin','Perm_COUNT','Permits']) as cursor:
    for row in cursor:          
        row[2] = ",".join(dict1[row[0]])
        #print (",".join(dict1[row[0]]))
        cursor.updateRow(row)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Apr 2021 22:07:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1049854#M60860</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-04-21T22:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: The row contains a bad value</title>
      <link>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1049977#M60861</link>
      <description>&lt;P&gt;The search cursor is returning a tuple of 3 elements matching the three fields requested.&amp;nbsp; The check for None is being done on the tuple when it should be the first element which matches the 'Pin' field.&amp;nbsp; Try:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.SearchCursor(fc,['Pin','Perm_COUNT','P_Num']) as cursor:
    for row in cursor:
        if row[0] not in (None, "", " "): # row[0] checks 'Pin'&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 06:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1049977#M60861</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-04-22T06:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: The row contains a bad value</title>
      <link>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1050097#M60863</link>
      <description>&lt;P&gt;Duh, I feel dumb. Got it working with the following with your help, thanks!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dict1 = dict()
with arcpy.da.SearchCursor(fc,['Pin','Perm_COUNT','P_Num']) as cursor:
    for row in cursor:
        if row[0] not in (None, "", " "): # forgot the [0]
            dict1.setdefault(row[0],[]).append(str(row[2]))
            #print (dict1)

with arcpy.da.UpdateCursor(fc,['Pin','Perm_COUNT','Permits']) as cursor:
    for row in cursor:
        if row[0] in dict1: #added to pass only attributes in dict
            row[2] = ",".join(dict1[row[0]])
            #print (",".join(dict1[row[0]]))
            cursor.updateRow(row&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 14:42:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/the-row-contains-a-bad-value/m-p/1050097#M60863</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-04-22T14:42:51Z</dc:date>
    </item>
  </channel>
</rss>

