<?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: NumPyArrayToFeatureClass (arcpy.da) in Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510953#M40130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what you mean about line 7?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2014 13:27:55 GMT</pubDate>
    <dc:creator>AlastairOram1</dc:creator>
    <dc:date>2014-08-29T13:27:55Z</dc:date>
    <item>
      <title>NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510947#M40124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-GB; mso-bidi-language: AR-SA; mso-fareast-theme-font: minor-latin;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I'm using arcmap 10.2 and have been trying in vain to get the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;numpyArrayToFeatureClass tool to work in a python script. It generates a shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;but the output I get only ever has an index column - no other columns are&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;output.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-GB; mso-bidi-language: AR-SA; mso-fareast-theme-font: minor-latin;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;When I use the code example here &lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018w0000001n000000" rel="nofollow" target="_blank"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt;&amp;nbsp; I get exactly the same problem. Can you please&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;give me any indication where I am going wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Alastair&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 08:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510947#M40124</guid>
      <dc:creator>AlastairOram1</dc:creator>
      <dc:date>2014-08-29T08:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510948#M40125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post your code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 12:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510948#M40125</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-29T12:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510949#M40126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alastair,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works fine for me. Please, use it and tell us what you get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1409314235103815" jivemacro_uid="_1409314235103815"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;import arcpy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;import numpy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;outFC = "E:/temp/testShape.shp"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;array = numpy.array([(1, 'testText1', (471316.3835861763, 5000448.782036674)),&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2, 'testText2', (470402.49348005146, 5000049.216449278))],&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; numpy.dtype([('idfield',numpy.int32),('textField','&amp;lt;U10'),('XY', '&amp;lt;f8', 2)]))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;arcpy.da.NumPyArrayToFeatureClass(array, outFC, ['XY'])&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 12:10:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510949#M40126</guid>
      <dc:creator>DanielGarcia</dc:creator>
      <dc:date>2014-08-29T12:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510950#M40127</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;Well a shape file gets created but only has an index column - no other fields - see below.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="68"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="68"&gt;idfield&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 12:58:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510950#M40127</guid>
      <dc:creator>AlastairOram1</dc:creator>
      <dc:date>2014-08-29T12:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510951#M40128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dani...line 7 is truncated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 12:58:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510951#M40128</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-29T12:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510952#M40129</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;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Note that I’m starting with a pandas data frame (df) and converting it using “to_records” (although I have tried several methods like 'df.as_matrix()';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;turbinesNPArray = df.to_records()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;dt = turbinesNPArray.dtype&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;#(Note this returns: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#[('index', '&amp;lt;i8'), ('TurbineID', '&amp;lt;f8'), ('X', '&amp;lt;f8'), ('Y', '&amp;lt;f8'), ('Z', '&amp;lt;f8'), ('HubH', '&amp;lt;f8'), ('RotorD', '&amp;lt;f8'), ('WGS84Lat', '&amp;lt;f8'), ('WGS84Long', '&amp;lt;f8'), ('OFFSETA', '&amp;lt;f8'), ('OFFSETB', '&amp;lt;f8')]&lt;/P&gt;&lt;P&gt;#type turbinesNPArray:&amp;lt;class 'numpy.core.records.recarray'&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;outShapeFile = r"%s\%s.shp" %(rootPath + "Outputs", "outLayout_temp")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.da.NumPyArrayToFeatureClass(turbinesNPArray, outShapeFile, ("TurbineID","X","Y","Z","HubH","RotorD","WGS84Lat","WGS84Long","OFFSETA", "OFFSETB"), self.spRef)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 13:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510952#M40129</guid>
      <dc:creator>AlastairOram1</dc:creator>
      <dc:date>2014-08-29T13:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510953#M40130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what you mean about line 7?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 13:27:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510953#M40130</guid>
      <dc:creator>AlastairOram1</dc:creator>
      <dc:date>2014-08-29T13:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510954#M40131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I attach you py file and the result shapefile. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These work for me in ArcGIS 10.2.2.3552 version and Python 2.7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 09:36:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510954#M40131</guid>
      <dc:creator>DanielGarcia</dc:creator>
      <dc:date>2014-09-01T09:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510955#M40132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;module1&amp;gt;", line 23, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;RuntimeError: create table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 11:20:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510955#M40132</guid>
      <dc:creator>AlastairOram1</dc:creator>
      <dc:date>2014-09-02T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToFeatureClass (arcpy.da) in Python script</title>
      <link>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510956#M40133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that you are not correctly setting up the nparray:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14098302064696957" jivemacro_uid="_14098302064696957"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;turbinesNPArray = df.to_records()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without knowing your fields info, I don't see you fully qualifying the fields in your conversion from Pandas DataFrame to NumPy Array.&amp;nbsp;&amp;nbsp; You can try the following but I have no real way to test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14098308391867858" jivemacro_uid="_14098308391867858"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;turbinesNPArray = numpy.array(df.to_records(), numpy.dtype([('index', '&amp;lt;i8'), ('TurbineID', '&amp;lt;f8'), ('X', '&amp;lt;f8'), ('Y', '&amp;lt;f8'), ('Z', '&amp;lt;f8'), ('HubH', '&amp;lt;f8'), ('RotorD', '&amp;lt;f8'), ('WGS84Lat', '&amp;lt;f8'), ('WGS84Long', '&amp;lt;f8'), ('OFFSETA', '&amp;lt;f8'), ('OFFSETB', '&amp;lt;f8')]))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2014 11:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpyarraytofeatureclass-arcpy-da-in-python-script/m-p/510956#M40133</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-09-04T11:40:58Z</dc:date>
    </item>
  </channel>
</rss>

