<?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: python list in memory to arcpy Table? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531976#M41659</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks much for the detailed example - this will certainly help! I figured using cursors was one way to do it, but was hoping there might be a simple way to directly transfer an in-memory list/array to a table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2012 14:09:05 GMT</pubDate>
    <dc:creator>DanSlayback</dc:creator>
    <dc:date>2012-07-19T14:09:05Z</dc:date>
    <item>
      <title>python list in memory to arcpy Table?</title>
      <link>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531974#M41657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm wondering if there is a way to convert a list in python (or it could be an array, I think) to a Table object, that I'll then do further geoprocessing on. Currently, the only way I can get this to work is to write the list to a csv file, and then use arcpy.TableToGeodatabase_conversion to bring that csv file into a geodatabase. I dont want the csv file, so would prefer to simply pass the list object in memory to the geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And actually, I'd like to not even put it in the geodatabase, but just keep it as a Table object in memory. I'll then run&amp;nbsp; arcpy.MakeXYEventLayer_management, and then run the IDW tool on the resulting layer to get the desired output raster. I'd rather not keep around (or have to bother deleting) the intermediate files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like this should be trivially easy, but I cant find any hints on how to do this. I have tried to pass the python list object directly to MakeXYEventLayer, but it just hangs/takes forever. Presumably eventually it would return an error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 08:40:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531974#M41657</guid>
      <dc:creator>DanSlayback</dc:creator>
      <dc:date>2012-07-18T08:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: python list in memory to arcpy Table?</title>
      <link>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531975#M41658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why not create temporary in_memory point feature class right away.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then populate fields with values from list using InsertCursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy,&amp;nbsp; os arcpy.env.overwriteOutput = True&amp;nbsp; #list of lists with values [X, Y, InterpolationValue] valLst = [&amp;nbsp; [20.0, 50.0, 345], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [20.0, 51.0, 346], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [20.5, 50.5, 347] ]&amp;nbsp; #set up spatial reference and names prjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj") spatialRef = arcpy.SpatialReference(prjFile)&amp;nbsp; tempWorkspace = "in_memory" outXYfc = "XY_FeatureClass"&amp;nbsp; #create in_memory empty feature class arcpy.CreateFeatureclass_management(tempWorkspace, outXYfc , "POINT", "","","", spatialRef)&amp;nbsp; #build temp FC path and add new field for values to interpolate tempFC = os.path.join(tempWorkspace, outXYfc) arcpy.AddField_management(tempFC, "InterpVal", "DOUBLE")&amp;nbsp; #create insert cursor inCur = arcpy.InsertCursor(tempFC) #loop through main list, add values to cursor row and insert row for element in valLst: &amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point(element[0], element[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp; row = inCur.newRow() &amp;nbsp;&amp;nbsp;&amp;nbsp; row.Shape = pnt &amp;nbsp;&amp;nbsp;&amp;nbsp; row.InterpVal = element[2] &amp;nbsp;&amp;nbsp;&amp;nbsp; inCur.insertRow(row)&amp;nbsp; del inCur, row&amp;nbsp; #FOR TESTING: test if temporary feature class is OK #arcpy.CopyFeatures_management(tempFC, r"C:\tmp\Test.gdb\XYpoints")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's a result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16188[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 10:03:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531975#M41658</guid>
      <dc:creator>MarcinGasior</dc:creator>
      <dc:date>2012-07-18T10:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: python list in memory to arcpy Table?</title>
      <link>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531976#M41659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks much for the detailed example - this will certainly help! I figured using cursors was one way to do it, but was hoping there might be a simple way to directly transfer an in-memory list/array to a table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 14:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-list-in-memory-to-arcpy-table/m-p/531976#M41659</guid>
      <dc:creator>DanSlayback</dc:creator>
      <dc:date>2012-07-19T14:09:05Z</dc:date>
    </item>
  </channel>
</rss>

