Can no longer use a Result object to create Spatial Dataframe (ArcGIS API for Python 1.9.0)

597
8
07-29-2021 06:18 AM
JohnHuillery1
Occasional Contributor

After upgrading to ArcGIS API for Python 1.9.0 I can no longer use a Result object to create Spatial Dataframe.

*Apologies for not formatting the code as code.  I'm not sure where that option went

Example code:

import arcpy
import pandas as pd
from arcgis.features import Feature

result_object = arcpy.Intersect_analysis([valid_input1, valid_input2], r'in_memory\output')

df = pd.DataFrame.spatial.from_featureclass(result_object)

Error message:

ValueError: filename must be a `str`, `Path`, or `PurePath`, not <class 'arcpy.arcobjects.arcobjects.Result'>

 

The workaround is to use:

df = pd.DataFrame.spatial.from_featureclass(r'in_memory\output')

instead of the Result object variable, but now I have to change my code

 

8 Replies
DanPatterson
MVP Esteemed Contributor

Code formatting ... the Community Version - Esri Community for future reference


... sort of retired...
0 Kudos
JohnHuillery1
Occasional Contributor

It looks like the elipsis is gone now Capture.PNG

0 Kudos
DanPatterson
MVP Esteemed Contributor

format_code_access.png

Works for me.  Edge browser on a laptop.

They still haven't got around to putting the code formatting symbol on the main line yet.


... sort of retired...
0 Kudos
JohnHuillery1
Occasional Contributor

I'm on chrome. No code formatting option

0 Kudos
feralcatcolonist
Occasional Contributor

I'd love to know the rationale behind this change, this seems like a step backward?


Likes an array of [cats, gardening, photography]
JohnHuillery1
Occasional Contributor

Why is this flagged as the solution?

0 Kudos
feralcatcolonist
Occasional Contributor

I have no idea, I thought you were being cheeky. As the OP you should have control to set what is the accepted solution.


Likes an array of [cats, gardening, photography]
0 Kudos
JohnHuillery1
Occasional Contributor

Fixed

0 Kudos