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

330
4
07-29-2021 06:18 AM
JohnHuillery1
New Contributor III

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

 

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...
0 Kudos
JohnHuillery1
New Contributor III

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
New Contributor III

I'm on chrome. No code formatting option

0 Kudos