<?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: arcpy.UpdateCursor setting a row value to null instead of 0 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177211#M13635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'd need to use a geodatabase feature class instead of a shapefile to accomplish this. Shapefiles do not support NULL values. This is documented on the following page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Add Field (Data Management)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Fdesktop%2Flatest%2Ftools%2Fdata-management-toolbox%2Fadd-field.htm" rel="nofollow" target="_blank"&gt;http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-field.htm&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As shown in the screenshot below, Null values are only supported for fields in a geodatabase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="128062" alt="2015-09-23_1606.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/128062_2015-09-23_1606.png" style="width: 620px; height: 408px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2015 23:05:20 GMT</pubDate>
    <dc:creator>FreddieGibson</dc:creator>
    <dc:date>2015-09-23T23:05:20Z</dc:date>
    <item>
      <title>arcpy.UpdateCursor setting a row value to null instead of 0</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177210#M13634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having issues setting a row value to 0 when joining a csv to a shapefile. When the shapefile value is not in the csv, the row is getting set to 0 instead of null. This is a huge problem as i'm showing 0 change instead of no data. I tried row.setValue(field, None) and row.setNull(field) and both produce the same result. In the .dbf file of the shapefile, there is no value but in the UI attribute table a 0 is shown. Any advice on how to fix this would be very appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Shane&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(shpfile, "TEST", "DOUBLE", field_is_nullable = 'NULLABLE')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newcols = ["TEST"]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(csvfile, 'rb') as csvfile:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lib = dict()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvfile = csv.reader(csvfile, delimiter = ",")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvfile.next() #skip the headers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for line in csvfile:&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; lib[line[csvjoinindex]] = lib.get(line[csvjoinindex],line[csvstartfield:])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor(shpfile)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpjoinval = str(row.getValue(shapefilejoincol))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&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; vals = lib.get(shpjoinval)&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; for ind, field in enumerate(newcols):&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(str(field),vals[ind])&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&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; for ind, field in enumerate(newcols):&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setNull(field)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2015 22:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177210#M13634</guid>
      <dc:creator>ShaneArmour</dc:creator>
      <dc:date>2015-09-23T22:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.UpdateCursor setting a row value to null instead of 0</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177211#M13635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'd need to use a geodatabase feature class instead of a shapefile to accomplish this. Shapefiles do not support NULL values. This is documented on the following page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Add Field (Data Management)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Fdesktop%2Flatest%2Ftools%2Fdata-management-toolbox%2Fadd-field.htm" rel="nofollow" target="_blank"&gt;http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-field.htm&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As shown in the screenshot below, Null values are only supported for fields in a geodatabase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="128062" alt="2015-09-23_1606.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/128062_2015-09-23_1606.png" style="width: 620px; height: 408px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2015 23:05:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177211#M13635</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2015-09-23T23:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.UpdateCursor setting a row value to null instead of 0</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177212#M13636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;specifics to shapefiles regarding nulls or lack thereof&lt;/P&gt;&lt;TABLE style="margin-bottom: 1.5em; font-size: 0.875em; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; background-color: white; border: 1px solid #dcdcdc; color: #4d4d4d;"&gt;&lt;THEAD style="background-color: #f3f3f3; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dcdcdc; font-size: 0.9375em; font-weight: bold;"&gt;&lt;TR style="border-bottom-style: none;"&gt;&lt;TH style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;Data type containing null value&lt;/TH&gt;&lt;TH style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;Null value substitution&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY class="align-middle"&gt;&lt;TR class="align-middle" style="border-bottom-width: 1px; border-bottom-color: #dcdcdc;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;Number—When tool requires that a NULL, infinity, or NaN (&lt;SPAN style="font-weight: bold;"&gt;N&lt;/SPAN&gt;ot &lt;SPAN style="font-weight: bold;"&gt;a &lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;N&lt;/SPAN&gt;umber) be output&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;-1.7976931348623158e+308 (IEEE standard for the maximum negative value)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="align-middle" style="border-bottom-width: 1px; border-bottom-color: #dcdcdc;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;Number (all other geoprocessing tools)&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="align-middle" style="border-bottom-width: 1px; border-bottom-color: #dcdcdc;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;Text&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;" " (blank—no space)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="align-middle" style="border-bottom-style: none;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left-width: 1px; border-left-style: solid; border-left-color: #dcdcdc; border-right-width: 1px; border-right-style: solid; border-right-color: #dcdcdc; padding: 12px;"&gt;&lt;P style="font-size: 0.875rem;"&gt;Stored as zero, but displays &lt;SPAN class="usertext" style="font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-weight: bold;"&gt;&amp;lt;null&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;from here&amp;nbsp; &lt;A href="http://desktop.arcgis.com/en/desktop/latest/manage-data/shapefiles/geoprocessing-considerations-for-shapefile-output.htm#GUID-A10ADA3B-0988-4AB1-9EBA-AD704F77B4A2" title="http://desktop.arcgis.com/en/desktop/latest/manage-data/shapefiles/geoprocessing-considerations-for-shapefile-output.htm#GUID-A10ADA3B-0988-4AB1-9EBA-AD704F77B4A2"&gt;Geoprocessing considerations for shapefile output—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2015 23:47:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-updatecursor-setting-a-row-value-to-null/m-p/177212#M13636</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-09-23T23:47:57Z</dc:date>
    </item>
  </channel>
</rss>

