Using pandas in ArcGIS pro

3595
6
Jump to solution
10-23-2017 01:14 AM
YasunariMorita
New Contributor II

I try to deal with table data by using pandas from ArcGIS pro.

But, I have mysterious error below.

Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\pandas\__init__.py", line 25, in <module>
from pandas import hashtable, tslib, lib
File "pandas\tslib.pyx", line 5421, in init pandas.tslib (pandas\tslib.c:114996)
File "pandas\tslib.pyx", line 5338, in pandas.tslib.TimeRE.__init__ (pandas\tslib.c:85126)
File "pandas\tslib.pyx", line 5219, in pandas.tslib.LocaleTime.__init__ (pandas\tslib.c:82425)
File "pandas\tslib.pyx", line 5239, in pandas.tslib.LocaleTime.__calc_weekday (pandas\tslib.c:82859)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\calendar.py", line 79, in __getitem__
return funcs(self.format)
ValueError: embedded null byte

"null byte" probably means that some paths or file names include \0,but where?

And, this error happens only in case of python3.

any advice would be helpful.
Thanks in advance!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

I suspect it might have something to do with the newer 'arcgis' module which uses pandas as a shell for the SpatialDataFrame.  If you examine the menu tree in windows, pandas is indeed installed.  Hence the reason I was asking where you are running python from.  When using Pro, you should be using python and everything from the required anaconda package distribution.  

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

What is the nature of the table?  (type, field names, data types etc)

How are you accessing Pandas? (Pro script window, another IDE etc, a tool from within arctoolbox in Pro?)

can you convert/load the table within Pro without issue?

Any other useful details.

0 Kudos
YasunariMorita
New Contributor II

Thanks

From Pro script window, I typed "import pandas as pd",then occurred the error.

I checked "import pandas as pd" in many way.

I try test.py script below.(execute command:propy.dat test.py)

import arcpy
import pandas as pd

ERROR

BUT, 

import pandas as pd

import arcpy

SUCCESS!

Why import pandas after import arcpy???

0 Kudos
DanPatterson_Retired
MVP Emeritus

I suspect it might have something to do with the newer 'arcgis' module which uses pandas as a shell for the SpatialDataFrame.  If you examine the menu tree in windows, pandas is indeed installed.  Hence the reason I was asking where you are running python from.  When using Pro, you should be using python and everything from the required anaconda package distribution.  

ShaunWalbridge
Esri Regular Contributor

Hello Yasunari,

Could you share what version of ArcGIS Pro you're using, and what version of Windows? Could you also run this from the Python prompt in Pro:

import locale, time
local.setlocale(local.LC_ALL, 'ja')
time.strftime('%a')

Does that produce the same error?

Thanks,

Shaun

YasunariMorita
New Contributor II

Hi,Shaun,

version of ArcGIS Pro:1.4.1

version of Windows:windows 7 professional SP1 (64bit)

I ran your code, and it porduced the same error!

import locale, time
locale.setlocale(locale.LC_ALL, 'ja')
'ja'
time.strftime('%a')
Runtime error
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: embedded null byte

I wish this was helpful for you.

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Ah yes, thanks. Yes, this is a problem with the Windows C Runtime (UCRT) that is shipped with ArcGIS Pro 1.4 and earlier. We've fixed the problem in ArcGIS Pro 2.0, if you can upgrade.

Cheers, Shaun