Select to view content in your preferred language

arcpy/arcgis and geodatable tables

503
1
06-10-2022 09:18 AM
Labels (1)
kkUSGS
by
New Contributor II

Hello Pro users,

I'm using the arcpy and arcgis libraries to access feature classes from a geodatabase. The geodatabase also contains non-spatial tables. I would like to read and write these tables leveraging arcpy and pandas. That is, pandas allows much greater functionality for completing operations (compared to search cursors). But, the arcpy/arcgis allow me to access tables stored in geodatabases (and not have to have duplicative tables in a text or csv format).

I can't find documentation for what method/library to use. And it seems that this functionality may not exist (see this post of a similar issue: https://community.esri.com/t5/arcgis-api-for-python-questions/export-dataframe-to-table/td-p/1019327).

Currently, I access feature classes via the spatially enable dataframe using:

pd.DataFrame.spatial.from_featureclass(filehere)

If I try that same call on a table within the geodatabase, I receive the error: KeyError: 'shapeType' which I'm assuming is because the table doesn't have a shape field. However, I can't find documentation of the available spatial methods to see if there is a similar method in the .spatial classes (like pd.DataFrame.spatial.from_table()). I want to be able to read the table into memory. Not just point to the file location or create an in-memory layer (which is what arcpy.MakeTableView_management() would do).

Am I  missing something simple? Any ideas?

1 Reply
by Anonymous User
Not applicable

It looks like there are 2 good solutions at this SO question.

It also looks like ESRI is working on that feature here.

0 Kudos