Add support for Pandas Dataframes to arcpy

02-14-2018 02:12 PM
Status: Under Consideration
Labels (1)
New Contributor III

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 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 arcpy.da.NumPyArrayToFeatureClass doesn't support. So each column's dtype has to be checked and converted if necessary.

It'd be great to have a arcpy.da.FeatureClassToDataFrame and arcpy.da.DataFrameToFeatureClass.

Tags (3)

Hi, I'm no pandas expert (never used it!) but there is a simple example of creating a DataFrame from a cursor here:

Summary Statistics—Help | ArcGIS Desktop 


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.


Have you tried the Spatially Enabled DataFrame? Introduction to the Spatially Enabled DataFrame | ArcGIS for Developers 

  1. Import necessary modules
  2. read from a feature class into a dataframe
  3. write from dataframe to feature class

screen shots from documentation

by MVP Regular Contributor

When will this feature be released roughly? it will make jupyter notebook in ArcGIS Pro more useful for data analysis.

Status changed to: In Product Plan

Hello all,

Thank you for your interest and feedback! As pointed out by @alex_friant, it is already possible to convert a data frame to a featureclass and vice versa using the ArcGIS API for Python.

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.

Status changed to: Under Consideration

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". 

In the meantime, consider using Arrow Tables as the middleman. Arrow Tables can be read directly into Geoprocessing tools. 

With the sedf.spatial.to_arrow() method you can convert your SEDF to an arrow table that is compatible with Geoprocessing tools. For example, try this:

patable = sedf.spatial.to_arrow();  # geometry encoding is WKB, os.path.join(out_dir, 'new_fc'))