Esri / Esri/arcgis-python-api

df.spatial.to_table error

Open
#1,528 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.2k
Forks
1.2k
Avg merge
2h 40m
Merged PRs (30d)
2

Description

**Describe the bug**
This error has been present for a while. I was avoiding it by manually constructing the table and inserting data with arcpy cursor. However, now the cursor does not accept the data anymore.

As a workaround, I created a feature class with points at 0,0 and copied the data to a table, but this is temporary and I hope to find a permanent solution.

**To Reproduce**
Steps to reproduce the behavior:
```python
import pandas as pd
from numpy import dtype
from pandas import Int64Dtype
from arcgis.features import GeoAccessor
import os
result = '{"holeid":{"0":"test","1":"test"},"projectcode":{"0":"test","1":"test"},"geolfrom":{"0":0.0,"1":3.21},"geolto":{"0":3.21,"1":6.31},"priority":{"0":1,"1":1},"shd_column":{"0":null,"1":null},"shd_core_box":{"0":1,"1":2},"shd_line":{"0":null,"1":null},"shd_numberid":{"0":"","1":""},"shd_pallet":{"0":"","1":""},"shd_side":{"0":"","1":""},"shd_obs":{"0":null,"1":null},"shd_core_obs_big":{"0":"","1":""},"shd_street":{"0":"","1":""},"shd_floor":{"0":null,"1":null},"shd_exclude_approve":{"0":null,"1":null},"shd_exclude_date":{"0":null,"1":null},"shd_exclude_type":{"0":null,"1":null},"shd_pallet_weight_kg":{"0":null,"1":null},"shd_core_load_date":{"0":null,"1":null},"shd_core_load_resp":{"0":"","1":""},"shd_start_d":{"0":1420070400000,"1":1420070400000},"shd_depth_d":{"0":560.2,"1":560.2},"shd_interval_d":{"0":"OK","1":"OK"},"shd_prospect_d":{"0":"test","1":"test"}}'

df = pd.read_json(result, dtype={'holeid': dtype('O'),
'projectcode': dtype('O'),
'geolfrom': dtype('float64'),
'geolto': dtype('float64'),
'priority': Int64Dtype(),
'shd_column': Int64Dtype(),
'shd_core_box': Int64Dtype(),
'shd_line': Int64Dtype(),
'shd_numberid': dtype('O'),
'shd_pallet': dtype('O'),
'shd_side': dtype('O'),
'shd_obs': dtype('O'),
'shd_core_obs_big': dtype('O'),
'shd_street': dtype('O'),
'shd_floor': Int64Dtype(),
'shd_exclude_approve': dtype('O'),
'shd_exclude_date': dtype('O'),
'shd_exclude_type': dtype('O'),
'shd_pallet_weight_kg': dtype('float64'),
'shd_core_load_date': dtype(' returned NULL without setting an error
```
**Screenshots**
![image](https://user-images.githubusercontent.com/20046591/232507730-d10d844c-fc81-435c-a862-9667ace9ecde.png)

**Expected behavior**
I suspect is some erro in arcpy.da and because of changes in version 2.1.0 I cant fix it myself on my side right now.

**Platform (please complete the following information):**
- OS: windows 10
- Python API Version 2.10

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.