<?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 TableToTable_Conversion writing extra fields? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522546#M40956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No.&amp;nbsp; The strings can be whatever length you specify, I simply chose 12 because looking over the data, it appeared 12 characters was more than enough to hold all the potential values.&amp;nbsp; If you need a 48 character string, either 'S48' or '|S48' would work.&amp;nbsp; If you are working with Unicode, then use a U in place of an S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Feb 2015 16:13:14 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2015-02-09T16:13:14Z</dc:date>
    <item>
      <title>Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522540#M40950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to write two headers, but am receving my actual two headers and 3 blank fields. What could be the cause of this? Here is my script and output. The script parses a JSON web-service and sends lat/lng of buses to a table in a file geodatabase. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Fq99B.png" class="jive-image image-1" src="http://i.stack.imgur.com/Fq99B.png" style="width: 620px; height: 309px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="s2f3s.png" class="jive-image image-2" src="http://i.stack.imgur.com/s2f3s.png" style="width: 620px; height: 232px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; requests
&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; json
&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; urllib2
&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; csv
&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy





&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Exists&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\MYLATesting.gdb\API_Table"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;):&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&amp;nbsp; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Delete_management&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\MYLATesting.gdb\API_Table"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

url &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://api.metro.net/agencies/lametro/vehicles/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://api.metro.net/agencies/lametro/vehicles/&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
parsed_json &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; json&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;load&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;urllib2&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;urlopen&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://api.metro.net/agencies/lametro/vehicles/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://api.metro.net/agencies/lametro/vehicles/&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
details &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'items'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'longitude'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
headers &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'Content-type'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'application/x-www-form-urlencoded'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'Accept'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'/'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
response &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; requests&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;get&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;url&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; data&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;json&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;dumps&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;details&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;),&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; headers&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;headers&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;


&lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;# tell computer where to put CSV&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
outfile_path&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'C:\Users\Administrator\Desktop\API_Testing.csv'&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

&lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;# open it up, the w means we will write to it&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
writer &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; csv&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;writer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;open&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;outfile_path&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'wb'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

&lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;#create a list with headings for our columns&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
headers &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'latitude'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'longitude'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; items &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; parsed_json&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'items'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;]:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&amp;nbsp; row &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;[]&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&amp;nbsp; row&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;append&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;str&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;items&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'latitude'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;]).&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;encode&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'utf-8'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&amp;nbsp; row&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;append&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;str&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;items&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'longitude'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;]).&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;encode&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'utf-8'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&amp;nbsp; writer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;writerow&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;row&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

i &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
i &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; i &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

f &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; open&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;outfile_path&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'wb'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
writer &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; csv&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;writer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;f&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
&lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;#write the row of headings to our CSV file&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;
writer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;writerow&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;headers&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

f&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;close&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;()&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

&lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;#Temporary Delete Function to Overwrite Table&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;TableToTable_conversion&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;outfile_path&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\MYLATesting.gdb"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"API_Table"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;

&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;print&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; response&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;text&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522540#M40950</guid>
      <dc:creator>GeoffreyWest</dc:creator>
      <dc:date>2021-12-11T22:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522541#M40951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of troubleshooting your current approach, I am going to suggest a different one for a couple of reasons.&amp;nbsp; First, there seems to be lines in your code that aren't doing anything, or at least not contributing to building your table.&amp;nbsp; Fortunately your screenshots can be used to figure out the intent of the code.&amp;nbsp; Second, writing the results to an intermediate/temporary CSV file on disk adds extra steps and slows performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NumPy conversion functions in the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/What_is_the_data_access_module/018w00000008000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;ArcPy Data Access module (arcpy.da)&lt;/A&gt; are very robust, high performing, and I would argue designed for situations just like this one.&amp;nbsp; Although I still find NumPy documentation lacking in clarity in many areas, it is well worth learning and using with and without ArcPy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import json
import numpy
import urllib2

tbl = #table location
if arcpy.Exists(tbl):&amp;nbsp; 
&amp;nbsp; arcpy.Delete_management(tbl)

url = "&lt;A href="http://api.metro.net/agencies/lametro/vehicles/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://api.metro.net/agencies/lametro/vehicles/&lt;/A&gt;"&amp;nbsp; 
parsed_json = json.load(urllib2.urlopen(url))

LatLongs = []
for item in parsed_json['items']:
&amp;nbsp;&amp;nbsp;&amp;nbsp; LatLongs.append((
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(item['latitude']).encode('utf-8'),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(item['longitude']).encode('utf-8')
&amp;nbsp;&amp;nbsp;&amp;nbsp; ))
narr = numpy.array(LatLongs,
&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;&amp;nbsp;&amp;nbsp; numpy.dtype([('latitude', '|S12'), ('longitude', '|S12')]))
arcpy.da.NumPyArrayToTable(narr, tbl)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:47:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522541#M40951</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T22:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522542#M40952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The above concept can be expanded to download all the information and create a point feature class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp; 
import json&amp;nbsp; 
import numpy&amp;nbsp; 
import urllib2&amp;nbsp; 

fc = #feature class location&amp;nbsp; 
if arcpy.Exists(fc):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; arcpy.Delete_management(fc)&amp;nbsp; 

url = "&lt;A href="http://api.metro.net/agencies/lametro/vehicles/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://api.metro.net/agencies/lametro/vehicles/&lt;/A&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; 
parsed_json = json.load(urllib2.urlopen(url))&amp;nbsp; 
sr = arcpy.SpatialReference(4326)&amp;nbsp; #assuming wgs84 coords but didn't verify

ndtype = numpy.dtype([
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('id', 'S12'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('route_id', 'S12'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('run_id', 'S12'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('latitude', 'f8'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('longitude', 'f8'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('heading', 'f8'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('seconds_since_report', 'i4'),
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('predictable', '?')
])

vehicles = []&amp;nbsp; 
for item in parsed_json['items']:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; vehicles.append(tuple(item&lt;K&gt; for k in ndtype.names))&lt;/K&gt;

narr = numpy.array(vehicles,&amp;nbsp; ndtype)&amp;nbsp; 
arcpy.da.NumPyArrayToFeatureClass(narr, fc, ['longitude', 'latitude'], sr)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522542#M40952</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T22:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522543#M40953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3420"&gt;Joshua Bixby&lt;/A&gt;‌, nice short piece of code to get the job done! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 19:52:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522543#M40953</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-02-08T19:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522544#M40954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agreed, thank you Joshua. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 20:54:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522544#M40954</guid>
      <dc:creator>GeoffreyWest</dc:creator>
      <dc:date>2015-02-08T20:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522545#M40955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua, This implementation works wonders, however like you stated the NumPy documentation isn't all of that helpful.&amp;nbsp; My question is will string data types ALWAYS be 12 bytes?&amp;nbsp; This script is for a proof of concept, and another JSON web service will be used which I why I was using the requests module in the initial script, because I will have to execute a POST instead of GET request to the service.&amp;nbsp; I appreciate your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 04:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522545#M40955</guid>
      <dc:creator>GeoffreyWest</dc:creator>
      <dc:date>2015-02-09T04:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522546#M40956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No.&amp;nbsp; The strings can be whatever length you specify, I simply chose 12 because looking over the data, it appeared 12 characters was more than enough to hold all the potential values.&amp;nbsp; If you need a 48 character string, either 'S48' or '|S48' would work.&amp;nbsp; If you are working with Unicode, then use a U in place of an S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 16:13:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522546#M40956</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-02-09T16:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522547#M40957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it necessary to close the url when getting JSON?&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/a/14849166" title="http://stackoverflow.com/a/14849166"&gt;python - closing files properly opened with urllib2.urlopen() - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 18:43:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522547#M40957</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-02-09T18:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522548#M40958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case, there is no url to close.&amp;nbsp; The &lt;SPAN style="font-family: courier new,courier;"&gt;url&lt;/SPAN&gt; variable in the script is just a string.&amp;nbsp; The script never directly interacts with the file-like object returned by &lt;SPAN style="font-family: courier new,courier;"&gt;urllib2.urlopen&lt;/SPAN&gt;.&amp;nbsp; Instead, the&lt;SPAN style="font-family: courier new,courier;"&gt; json.load&lt;/SPAN&gt; method calls &lt;SPAN style="font-family: courier new,courier;"&gt;urllib2.open&lt;/SPAN&gt; and iterates through the returned file-like object.&amp;nbsp; Once &lt;SPAN style="font-family: courier new,courier;"&gt;json.load&lt;/SPAN&gt; returns, everything it created goes out of scope, including objects returned by &lt;SPAN style="font-family: courier new,courier;"&gt;urllib2.urlopen&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 20:09:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522548#M40958</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-02-09T20:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522549#M40959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Joshua.&lt;/P&gt;&lt;P&gt;A little off topic:&lt;/P&gt;&lt;P&gt;I am using Python with ArcGIS Server 10.2.2 to get tokens and stop/start services. To request a token, I use urlllib2 to open the request url and read the json response. To stop/start services, I use urllib to open the request url and read the JSON response. In both cases I thought it was necessary to do it in a with statement using contextlib to close it when finished. &lt;A _jive_internal="true" href="https://community.esri.com/message/446375"&gt;Here is my thread&lt;/A&gt;. Sorry for the hijack! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 20:31:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522549#M40959</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-02-09T20:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy TableToTable_Conversion writing extra fields?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522550#M40960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's jump over to the other thread to continue the discussion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2015 20:48:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-tabletotable-conversion-writing-extra-fields/m-p/522550#M40960</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-02-09T20:48:36Z</dc:date>
    </item>
  </channel>
</rss>

