Spatially enabled dataframe .from_layer() method throwing __deepcopy__ error

291
1
Jump to solution
03-20-2024 09:07 AM
JohnHuillery1
Occasional Contributor

When I try to read data from a hosted feature service into a spatially enabled dataframe I get the following error:

 

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jhuillery\Desktop\JH_PY\work_alone\venv\lib\site-packages\arcgis\features\geo\_accessor.py", line 3112, in from_layer
raise Exception("Could not load the dataset: %s" % str(e))
Exception: Could not load the dataset: '__deepcopy__'

 

Python: 3.10.11

Arcgis API: 2.2.0.3

pandas: 2.2.1

I don't have ArcGIS Pro installed on this machine.

Sample code:

 

from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
 
gis = GIS(username='<username>', password='<pw>')
data = FeatureLayerCollection(<valid_url>, gis)
df = pd.DataFrame.spatial.from_layer(data.layers[0])

 

 
 
0 Kudos
1 Solution

Accepted Solutions
JohnHuillery1
Occasional Contributor

Solved by downgrading Pandas to 2.0.2

View solution in original post

1 Reply
JohnHuillery1
Occasional Contributor

Solved by downgrading Pandas to 2.0.2