Hi
I previously used the SpatialDataFrame object to access online feature services. With the update of the API to 1.5.1, I have tried to utlise the new Spatially Enabled Dataframe object in the same way, as that appears to be preferred way going forward but I'm running into issues trying to access the same dataset I had no issues accessing with a SpatialDataFrame.
This is the error I receive when I use the simple code below
Exception: Could not load the dataset: cannot perform __truediv__ with this index type: DatetimeIndex
item = gis.content.get("ItemID")
flayer = item.layers[1]
sdf = pd.DataFrame.spatial.from_layer(flayer)
I'm using Python 3.6.7 with the latest version of ArcGISPro
Has anyone had similar issues?
Solved! Go to Solution.
We've fixed an issue with the Spatially Enabled Dataframe `from_layer()` method that will be available in tomorrow morning's release. Can you run the code after updating the api to 1.5.2 tomorrow and let me now if that addresses the issue?
The example code from Introduction to the Spatial DataFrame | ArcGIS for Developers works for me:
from arcgis.features import SpatialDataFrame
from arcgis import GIS
gis = (url, username, password)
item = gis.content.get("id")
flayer = item.layers[0]
sdf = SpatialDataFrame.from_layer(flayer)
The error seems to be with datetime... do you have datetime field(s) in your dataset?
We've fixed an issue with the Spatially Enabled Dataframe `from_layer()` method that will be available in tomorrow morning's release. Can you run the code after updating the api to 1.5.2 tomorrow and let me now if that addresses the issue?
John Yaist the update fixes the issue and using the new object has also has improved the time taken to run the script considerably.
Cheers
Sweet! Thanks for the follow-up, Matthew Skewes. Bonus on the performance boost - we're always investigating ways to improve on that...good to hear!