import_data Documentation or Code Bug

428
3
01-15-2018 09:20 AM
JoshuaBixby
MVP Esteemed Contributor

This question is directed at the ArcGIS API for Python staff participating in GeoNet.

I am trying to determine whether there is a software or code bug with import data - arcgis.gis module — arcgis 1.3.0 documentation.  According to the documentation, import_data works with a Pandas dataframe and can load a Pandas dataframe spatially if address_fields are present.

While helping troubleshoot UnboundLocalError: local variable 'fc_layer_definition' referenced before assignment, I came to find that including "x" and "y" fields in a Pandas dataframe is supported, and that points will be automatically created without adding any additional arguments.  Attempting to generate a spatial dataframe similarly, spf = arcgis.features.SpatialDataFrame.from_df(df), generates an error and says no address fields are present.

So, is import_data supposed to support adding Pandas dataframes with "x" and "y" columns or not?  If yes, where is that documented?

0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor
0 Kudos
AndrewChapkowski
Esri Regular Contributor

Can you please add an example CSV that you are trying to use? 

Also, can you post your code as well?

Thanks

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I took the screenshot of data from https://community.esri.com/thread/207898-unboundlocalerror-local-variable-fclayerdefinition-referenc... and uploaded it as a CSV after renaming long,lat columns to x,y.

0 Kudos