<?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: Replace empty attributes through 0 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506262#M39827</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fields to replace Null throught "0" are string fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Nov 2014 08:53:29 GMT</pubDate>
    <dc:creator>JohannesBierer</dc:creator>
    <dc:date>2014-11-17T08:53:29Z</dc:date>
    <item>
      <title>Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506261#M39826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14162141944278759" jivemacro_uid="_14162141944278759"&gt;
&lt;P&gt;import arcpy&amp;nbsp; &lt;/P&gt;
&lt;P&gt;import os&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;in_data = r"R:\natura 2000\8847.04 MaP\7517-341_Horber_Neckarhaenge\Daten_Offenland\2014-11-12_PE_Maßnahmenentwurf\Reperatur\Reperatur.gdb\data\massnahmen_anm56_141117"&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;field_list = []&amp;nbsp; &lt;/P&gt;
&lt;P&gt;numeric_fields = ["Double", "Integer", "SmallInteger"]&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;fields = arcpy.ListFields(in_data)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;for field in fields:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if (field.type in numeric_fields):&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_list.append(field.name)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;# convert the list of fields to a semicolor delimited string&amp;nbsp; &lt;/P&gt;
&lt;P&gt;fields = ";".join(field_list)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;rows = arcpy.UpdateCursor(in_data, '', '', fields)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;count = len(field_list)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;for row in rows:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for k in range(count):&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.isNull(field_list&lt;K&gt;):&amp;nbsp; &lt;/K&gt;&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; row.setValue(field_list&lt;K&gt;, 0)&amp;nbsp; &lt;/K&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't work? Why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 08:50:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506261#M39826</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T08:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506262#M39827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fields to replace Null throught "0" are string fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 08:53:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506262#M39827</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T08:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506263#M39828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure what the question is, but if it is a string field, and you want a zero representation then shouldn't nulls be replaced with "0" not 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 09:10:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506263#M39828</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-17T09:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506264#M39829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We work here with a GIS System which doen't allow Null values, so I try to repair the shape. Like this it is not loadable in that other GIS System.&lt;/P&gt;&lt;P&gt;Tried "0", nothing happens.&lt;/P&gt;&lt;P&gt;Might it be that the path is not reachable for python, with the point inside?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;&lt;SPAN class="string"&gt;... natura 2000&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;\8847.04 MaP&lt;/STRONG&gt;&lt;/SPAN&gt;\7517-341_ ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 09:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506264#M39829</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T09:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506265#M39830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This one, if you are interestesd in:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.disy.net/en/welcome.html" title="http://www.disy.net/en/welcome.html"&gt;Welcome | Disy&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 09:26:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506265#M39830</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T09:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506266#M39831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14162163263878621" jivemacro_uid="_14162163263878621"&gt;
&lt;P&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;using the os module in Python here are the results with a truncated path/filename and yours&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14162163462221125" jivemacro_uid="_14162163462221125"&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; p = r"R:\natura 2000\8847.04 MaP\7517-341_Horber_Neckarhaenge\Daten_Offenland\2014-11\test.py"&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import os&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; path, file_name =&amp;nbsp; os.path.split(p)&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; path&lt;/P&gt;
&lt;P&gt;'R:\\natura 2000\\8847.04 MaP\\7517-341_Horber_Neckarhaenge\\Daten_Offenland\\2014-11'&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; file_name&lt;/P&gt;
&lt;P&gt;'test.py'&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; p = r"R:\natura 2000\8847.04 MaP\7517-341_Horber_Neckarhaenge\Daten_Offenland\2014-11-12_PE_Maßnahmenentwurf\Reperatur\Reperatur.gdb\data\massnahmen_anm56_141117"&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; p&lt;/P&gt;
&lt;P&gt;'R:\\natura 2000\\8847.04 MaP\\7517-341_Horber_Neckarhaenge\\Daten_Offenland\\2014-11-12_PE_Ma\xc3\x9fnahmenentwurf\\Reperatur\\Reperatur.gdb\\data\\massnahmen_anm56_141117'&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; path, file_name =&amp;nbsp; os.path.split(p)&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; path&lt;/P&gt;
&lt;P&gt;'R:\\natura 2000\\8847.04 MaP\\7517-341_Horber_Neckarhaenge\\Daten_Offenland\\2014-11-12_PE_Ma\xc3\x9fnahmenentwurf\\Reperatur\\Reperatur.gdb\\data'&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; file_name&lt;/P&gt;
&lt;P&gt;'massnahmen_anm56_141117'&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so you can be the judge&lt;BR /&gt;(you might try moving the file to c:\ temp &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; for testing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 09:27:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506266#M39831</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-17T09:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506267#M39832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the link...interesting company&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 09:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506267#M39832</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-17T09:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506268#M39833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the script.&lt;/P&gt;&lt;P&gt;Sorry for bothering you. It was a problem with one null geometrie feature.&lt;/P&gt;&lt;P&gt;So I should keep in mind to check the geometrie first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Disy is quite a good solution, if you can't afford to pay esri exorbitant license fees.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 10:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506268#M39833</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T10:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506269#M39834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Johannes... In the academic world...I don't worry about those things &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 10:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506269#M39834</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-17T10:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Replace empty attributes through 0</title>
      <link>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506270#M39835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But maybe you want to use a gis in which you can't load corrupt shape files &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 10:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-empty-attributes-through-0/m-p/506270#M39835</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-11-17T10:48:42Z</dc:date>
    </item>
  </channel>
</rss>

