New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table query fails with "TypeError: Casting to unit-less dtype 'datetime64' is not supported. Pass e.g. 'datetime64[ns]' instead." #1777
Comments
@knoopum What version of the python api are you using? |
@nanaeaubry whichever version Esri has packaged in ArcGIS Online Notebooks (ArcGIS Notebook Python 3 Standard - 9.0) |
@knoopum I followed the steps to reproduce using the ArcGIS Notebook Python 3 Standard - 9.0 runtime in ArcGIS Online Notebooks without issue. Can you post a code snippet? Sidenote: You can check the
or navigating to Info > Runtime in the Notebook UI |
@tyhranac Sorry! I left off an important part of the instructions to reproduce. In step 5, when you query the table, set as_df = True. Querying for all the records works: Querying for a value that exists in the data also works: Querying for a value that does not exist in the data generates the error: |
I've been running into this issue too. I think the issue lies in that the "Fields" array that details all the different fields and their data types when returning just a featureset is included in for Feature Layer types but this isn't the case for Tables. So when you have date fields in a table it autos unit-less dtype. Interestingly if you query to make it a featureset and then use the sdf method on the featureset to return a dataframe it works but returns essentially an empty dataframe with no columns or dtypes. My work around is basically capturing the "Fields" array from the properties of the table, making a new dictionary that mimics the table featureset structure and injects the Fields array into it. Then when I create a Dataframe from this updated featureset it understands that the datetime fields should be 'datetime64[ns].
This outputs:
|
@knoopum can you please export your table to a FGDB and share it? or share the URL? |
Describe the bug
Querying a table will unexpectedly throw the following error, when there is no result to return and editor tracking is enabled for the table:
To Reproduce
Expected behavior
An empty result should be returned when there is no match.
Platform (please complete the following information):
ArcGIS Online Notebooks (ArcGIS Notebook Python 3 Standard - 9.0)
The text was updated successfully, but these errors were encountered: