Add support for Pandas Dataframes to arcpy

4655
4
02-14-2018 02:12 PM
Status: In Product Plan
Labels (1)
martinschaefer1
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)
4 Comments
BruceHarold

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 

martinschaefer1

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.

alex_friant

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

simoxu
by MVP Regular Contributor

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