<?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>idea Add support for Pandas Dataframes to arcpy in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idi-p/971962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pandas are a great asset for any data scientist. Data manipulation using pandas dataframes is powerful and easy. At the moment they only way to read feature class data into pandas for manipulation is using structured numpy arrays using&amp;nbsp;arcpy.da.FeatureClassToNumPyArray, and then convert that to a dataframe. That is quite straightforward, but the reverse is more difficult due to the data types dataframes use. Strings are usually stored as objects, which&amp;nbsp;arcpy.da.NumPyArrayToFeatureClass doesn't support. So each column's dtype has to be checked and converted if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It'd be great to have a arcpy.da.FeatureClassToDataFrame and arcpy.da.DataFrameToFeatureClass.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Feb 2018 22:12:21 GMT</pubDate>
    <dc:creator>martinschaefer1</dc:creator>
    <dc:date>2018-02-14T22:12:21Z</dc:date>
    <item>
      <title>Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idi-p/971962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pandas are a great asset for any data scientist. Data manipulation using pandas dataframes is powerful and easy. At the moment they only way to read feature class data into pandas for manipulation is using structured numpy arrays using&amp;nbsp;arcpy.da.FeatureClassToNumPyArray, and then convert that to a dataframe. That is quite straightforward, but the reverse is more difficult due to the data types dataframes use. Strings are usually stored as objects, which&amp;nbsp;arcpy.da.NumPyArrayToFeatureClass doesn't support. So each column's dtype has to be checked and converted if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It'd be great to have a arcpy.da.FeatureClassToDataFrame and arcpy.da.DataFrameToFeatureClass.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:12:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idi-p/971962</guid>
      <dc:creator>martinschaefer1</dc:creator>
      <dc:date>2018-02-14T22:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971963#M9435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm no pandas expert (never used it!) but there is a simple example of creating a DataFrame from a cursor here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/summary-statistics.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/summary-statistics.htm"&gt;Summary Statistics—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2019 19:02:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971963#M9435</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2019-02-26T19:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971964#M9436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cheers for the suggestion. However, creating DataFrames is not the issue. Creating a feature class from a DF is, due to the need to go via numpyarrays.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2019 09:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971964#M9436</guid>
      <dc:creator>martinschaefer1</dc:creator>
      <dc:date>2019-02-27T09:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971965#M9437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried the Spatially Enabled DataFrame?&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/#Example:-Reading-a-Featureclass-from-FileGDB" title="https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/#Example:-Reading-a-Featureclass-from-FileGDB"&gt;Introduction to the Spatially Enabled DataFrame | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Import necessary modules&lt;/LI&gt;&lt;LI&gt;read from a feature class into a dataframe&lt;/LI&gt;&lt;LI&gt;write from dataframe to feature class&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="screen shots from documentation" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/477102_dataframe_arcgis.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Dec 2019 20:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/971965#M9437</guid>
      <dc:creator>alex_friant</dc:creator>
      <dc:date>2019-12-27T20:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1174486#M19573</link>
      <description>&lt;P&gt;When will this feature be released roughly? it will make jupyter notebook in ArcGIS Pro more useful for data analysis.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 11:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1174486#M19573</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2022-05-17T11:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy - Status changed to: In Product Plan</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1187797#M20134</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;Thank you for your interest and feedback! As pointed out by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/76561" target="_blank"&gt;@alex_friant&lt;/A&gt;, it is already possible to convert a data frame to a featureclass and vice versa using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/#Accessing-local-GIS-data" target="_blank" rel="nofollow noopener noreferrer"&gt;ArcGIS API for Python&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;However, we are in the planning stages for the ArcGIS Pro 3.1 release and investigating supporting the use of an ArcGIS API for Python Spatially Enabled Data Frame (SEDF) directly as input in ArcPy. Please keep in mind that this does not guarantee that this feature will make it into the product, only that the possibility is currently being explored.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 14:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1187797#M20134</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2022-06-29T14:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy - Status changed to: Under Consideration</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1297224#M25333</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We realize the ArcGIS Pro 3.1 has come and gone and there has been no update on this. While we missed the 3.1 release and are likely to miss the 3.2 release as well, this is still actively being pursued. To better reflect the current status on this idea, I am reneging on the "In Product Plan" status and setting that status back a notch to "Under Consideration".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In the meantime, consider using &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/working-with-arrow-in-arcgis.htm" target="_self"&gt;Arrow Tables&lt;/A&gt; as the middleman. Arrow Tables can be read directly into Geoprocessing tools.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.html#arcgis.features.GeoAccessor.to_arrow" target="_self"&gt;sedf.spatial.to_arrow()&lt;/A&gt; method you can convert your SEDF to an arrow table that is compatible with Geoprocessing tools. For example, try this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;patable = sedf.spatial.to_arrow();  # geometry encoding is WKB
arcpy.management.CopyFeatures(patable, os.path.join(out_dir, 'new_fc'))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1297224#M25333</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2023-06-08T16:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1353722#M27246</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/50334"&gt;@HannesZiegler&lt;/a&gt;&amp;nbsp;I'm trying to convert a dataframe to an arrow table and then run a geoprocessing tool on the arrow table (converting the arrow table to a standalone table in the working geodatabase using the&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/export-table.htm" target="_self"&gt; Export Table&lt;/A&gt; tool). However, I get a fatal ArcGIS Pro error when running the line of code that calls the geoprocessing tool and the entire program shuts down. Have you seen something like this before?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulianaSpector1_0-1701116899697.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/87204iAD337C80F4DF7C7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulianaSpector1_0-1701116899697.png" alt="JulianaSpector1_0-1701116899697.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 20:28:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1353722#M27246</guid>
      <dc:creator>JulianaSpector1</dc:creator>
      <dc:date>2023-11-27T20:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1354366#M27272</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115085"&gt;@JulianaSpector1&lt;/a&gt;, this seems to be bug you are running into. If you haven't already, or if you are able to reproduce the crash, please submit an&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/get-started/report-software-errors-and-improvements.htm" target="_blank" rel="noopener nofollow noreferrer"&gt;error report&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;and include as much information as possible in the comment there.&amp;nbsp;&lt;SPAN&gt;Specifically, it would be helpful to know the method you used to convert the data frame into an Arrow Table.&amp;nbsp;Ideally, a comprehensive and reproducible workflow would help us to accurately understand what is happening.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 21:54:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1354366#M27272</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2023-11-28T21:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1406107#M29244</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115085"&gt;@JulianaSpector1&lt;/a&gt;&amp;nbsp;In the upcoming Pro 3.3 release we fixed a crash that sometimes occurred when the Arrow Table has an unsupported schema specification; it may be the same crash you were experiencing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 22:19:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1406107#M29244</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2024-04-04T22:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add support for Pandas Dataframes to arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1406117#M29245</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;It's been a while since this idea was posted, and there have been some developments since (as noted in the previous responses). We wanted to summarize the current existing paths for moving data from a Featureclass to a Pandas DataFrame, and back again to a FeatureClass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1) Use Apache Arrow&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;As described in the blog&amp;nbsp;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-pro/developers/leverage-apache-arrow-in-arcgis-pro/" target="_blank" rel="noopener"&gt;Leverage Apache Arrow in ArcGIS Pro (esri.com)&lt;/A&gt;, you can convert a FeatureClass to an Arrow Table, and from there convert to a Pandas DataFrame. You can also go the other way around, converting from a Pandas DataFrame to an Arrow Table, and from there to a FeatureClass.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt; &lt;EM&gt;if there is a geometry column,&amp;nbsp;&lt;/EM&gt;the conversion from an Arrow Table back to a FeatureClass requires properly specifying Esri's required schema for Arrow Tables. Here's a flexible function that can help with that step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def pandas_to_arrow(pdf, geom_fld, geom_encoding, geom_sr):
    """
    Convert a Pandas DataFrame to an Arrow Table with Esri required schema.

    Parameters
    ----------
    pdf : pandas.DataFrame
      The Pandas DataFrame to be converted to an Arrow Table with the Esri required schema applied.
    geom_fld : str
      The name of the geometry column.
    geom_encoding : str
      The geometry encoding of the geometry column. Valid values are "EsriShape", "EsriJSON", "WKB", "WKT", or "GeoJSON".
    geom_sr : str
      The spatial reference (as a WKT CSR string).

    Returns
    -------
    pyarrow.Table
        Arrow Table with Esri required schema applied.
    """

    # Create Arrow Table from PDF
    patable = pa.Table.from_pandas(pdf)

    # Grab the field that contains geometry &amp;amp; define Esri required schema
    fld = patable.field(geom_fld)
    fld = fld.with_metadata({'esri.encoding' : geom_type,'esri.sr_wkt': geom_sr})

    # Update the schema of the geometry field
    schema = patable.schema
    schema = schema.set(schema.get_field_index(geom_fld), fld)
    patable = patable.cast(schema)

    return patable&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note also:&lt;/STRONG&gt; If you're just moving around a table with no geometry, you don't need to worry about the schema.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2) Use the ArcGIS API for Python's Spatially Enabled DataFrame (SEDF)&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;This is the easiest way to move data between Pandas (SEDF) and a FeatureClass.&lt;/P&gt;&lt;P&gt;An SEDF is just a Pandas DataFrame extended with additional spatial capabilities. The blog linked above also shows how to round-trip from a FeatureClass to/from an SEDF. SEDF is part of ArcGIS, so there are easy to use built in methods that take care of everything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also use an SEDF directly as an input to ArcPy geoprocessing tools.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While these don't provide direct ArcPy to/fromDataFrame methods, we believe these options should cover the needs. Due to these existing options and other technical reasons, we are currently not considering a direct&amp;nbsp;&lt;SPAN&gt;arcpy.da.FeatureClassToDataFrame and arcpy.da.DataFrameToFeatureClass methods. However, we will keep this idea open for additional feedback for the time being.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your time and feedback&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 22:29:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/add-support-for-pandas-dataframes-to-arcpy/idc-p/1406117#M29245</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2024-04-04T22:29:52Z</dc:date>
    </item>
  </channel>
</rss>

