<?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 CSV Field Types in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160190#M12269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Newbie to Python, but have written a script to concatenate multiple CSV files into one file and add a couple of computed fields. I was wondering if there is a way specify field types in python where the finished CSV file would not require a schema.ini file to import fields in the correct format such as: date, Long, Double and also control the field width.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Mar 2013 14:08:40 GMT</pubDate>
    <dc:creator>MarkPaulson</dc:creator>
    <dc:date>2013-03-30T14:08:40Z</dc:date>
    <item>
      <title>CSV Field Types</title>
      <link>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160190#M12269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Newbie to Python, but have written a script to concatenate multiple CSV files into one file and add a couple of computed fields. I was wondering if there is a way specify field types in python where the finished CSV file would not require a schema.ini file to import fields in the correct format such as: date, Long, Double and also control the field width.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Mar 2013 14:08:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160190#M12269</guid>
      <dc:creator>MarkPaulson</dc:creator>
      <dc:date>2013-03-30T14:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Field Types</title>
      <link>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160191#M12270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;... is there a way specify field types in python where the finished CSV file would not require a schema.ini file to import fields in the correct format such as: date, Long, Double and also control the field width.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the field properties you are getting by default aren't correct you must &lt;/SPAN&gt;&lt;A href="http://www.gisnuts.com/terra/blog/2012/06/14/using-the-schemaini-file-to-import-a-csv-file-into-arcgis"&gt;create a schema.ini file&lt;/A&gt;&lt;SPAN&gt; - or edit an existing one in that folder - to get the field types you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alhough writing schema.ini in Python is not that difficult (the format is not that complicated) there is a another approach:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Python standard library includes the &lt;/SPAN&gt;&lt;A href="http://docs.python.org/2/library/csv.html"&gt;csv module&lt;/A&gt;&lt;SPAN&gt;, which you may be helpful to you as it will not convert data on input. You could read and append your csv data using Python lists, create a table with the schema you want, and then add the data to the table using an insert cursor. In this way you could bypass all the schema.ini jazz.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Mar 2013 23:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160191#M12270</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-03-30T23:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Field Types</title>
      <link>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160192#M12271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;The Python standard library includes the &lt;A href="http://docs.python.org/2/library/csv.html"&gt;csv module&lt;/A&gt;, which you may be helpful to you as it will not convert data on input. You could read and append your csv data using Python lists, create a table with the schema you want, and then add the data to the table using an insert cursor. In this way you could bypass all the schema.ini jazz.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Curt&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply. I am using the csv module to both read and write the multiple csv files into a merged file with some processing in between the merge. I played with the csv module, but I am not able to create the fields as I need them. I am using a schema.ini file, but it seems rather a kludge to have to keep track of it. Being new to this I am not following the "create a table" that you mentioned above. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 21:35:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/csv-field-types/m-p/160192#M12271</guid>
      <dc:creator>MarkPaulson</dc:creator>
      <dc:date>2013-04-03T21:35:33Z</dc:date>
    </item>
  </channel>
</rss>

