<?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: copying values from string type column to double column in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1124189#M63190</link>
    <description>&lt;P&gt;I realize now that some of my data is incorrectly inputted (see below) and therefor I get this error : "ValueError: invalid literal for float(): 3.745.562.167". I can easily remove the incorrect data now, but the code will actually be used by people without gis experience and unfortunately these error will probably occur in future data. Is there a way to delete these error value rows within my cursor?&amp;nbsp;&lt;/P&gt;&lt;P&gt;(still new to python, thanks for your help!)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="klabine_0-1639031769880.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29219i444AFBEB54709CCB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="klabine_0-1639031769880.png" alt="klabine_0-1639031769880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Dec 2021 07:37:04 GMT</pubDate>
    <dc:creator>klabine</dc:creator>
    <dc:date>2021-12-09T07:37:04Z</dc:date>
    <item>
      <title>copying values from string type column to double column</title>
      <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123767#M63169</link>
      <description>&lt;P&gt;Essentially I am trying to get xy coordinates from a CSV. I have already converted the CSV to DBase and added 2 new double fields for LAT and LONG. But the original latitude and longitude values are in string type fields and contain "NA" values for some of the coordinates. I can remove the NA fields using a cursor because they are useless for plotting xy coordinates but I still am unable to copy the coordinate data from the string type columns to the new double type columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="klabine_0-1638963776754.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29107i5186A7602A8114B2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="klabine_0-1638963776754.png" alt="klabine_0-1638963776754.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have also tried the 2 following cursors as well&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="klabine_1-1638963858106.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29108i677DA97F6D8A8CA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="klabine_1-1638963858106.png" alt="klabine_1-1638963858106.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and regardless of what I do I receive the following error:&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 999999: Error executing function.&lt;BR /&gt;The value type is incompatible with the field type. [LAT]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 12:46:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123767#M63169</guid>
      <dc:creator>klabine</dc:creator>
      <dc:date>2021-12-08T12:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: copying values from string type column to double column</title>
      <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123771#M63170</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lat = "45.0"

float(lat)
45.0&lt;/LI-CODE&gt;&lt;P&gt;You have to "float" text representations of numbers&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 13:12:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123771#M63170</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-08T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: copying values from string type column to double column</title>
      <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123774#M63171</link>
      <description>&lt;P&gt;Have you tried to explicitly convert the string to a double before writing it? For instance in your 2nd example:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;row[1] = float(row[0])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 13:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1123774#M63171</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-12-08T13:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: copying values from string type column to double column</title>
      <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1124189#M63190</link>
      <description>&lt;P&gt;I realize now that some of my data is incorrectly inputted (see below) and therefor I get this error : "ValueError: invalid literal for float(): 3.745.562.167". I can easily remove the incorrect data now, but the code will actually be used by people without gis experience and unfortunately these error will probably occur in future data. Is there a way to delete these error value rows within my cursor?&amp;nbsp;&lt;/P&gt;&lt;P&gt;(still new to python, thanks for your help!)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="klabine_0-1639031769880.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29219i444AFBEB54709CCB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="klabine_0-1639031769880.png" alt="klabine_0-1639031769880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 07:37:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1124189#M63190</guid>
      <dc:creator>klabine</dc:creator>
      <dc:date>2021-12-09T07:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: copying values from string type column to double column</title>
      <link>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1124227#M63191</link>
      <description>&lt;P&gt;Once I remove the weirdly formatted lat and long values it wont work using float but will work without so I have just done the following:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="klabine_0-1639036308587.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29234i7413CD0BBF7A1640/image-size/medium?v=v2&amp;amp;px=400" role="button" title="klabine_0-1639036308587.png" alt="klabine_0-1639036308587.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 09:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copying-values-from-string-type-column-to-double/m-p/1124227#M63191</guid>
      <dc:creator>klabine</dc:creator>
      <dc:date>2021-12-09T09:33:36Z</dc:date>
    </item>
  </channel>
</rss>

