我刚刚升级了我所有的python库,现在我以前的代码开始失败了。我正在使用 blaze 和熊猫。这是我的方法代码
blaze.data(res)
res 包含以下数据
col1 age ... col31 year
0 yes 55-64 ... NaN 2011
1 no 25-34 ... NaN 2011
2 no 55-64 ... NaN 2011
我正在使用以下依赖项
- python=3.6.11=h4d41432_2_cpython
- blaze=0.11.3=py36h4e06776_0
- odo=0.5.1=py36h90ed295_0
- pandas=1.0.5=py36h0573a6f_0
- numpy=1.19.1=py36h3849536_2
我收到以下错误
File "cytoolz/functoolz.pyx", line 667, in cytoolz.functoolz.pipe
File "cytoolz/functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/blaze/interactive.py", line 153, in data
dshape = discover(data_source)
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/multipledispatch/dispatcher.py", line 278, in __call__
return func(*args, **kwargs)
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/odo/backends/pandas.py", line 31, in discover_dataframe
for k in df.columns])
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/odo/backends/pandas.py", line 31, in <listcomp>
for k in df.columns])
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/odo/backends/pandas.py", line 23, in dshape_from_pandas
dshape = datashape.CType.from_numpy_dtype(col.dtype)
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/datashape/coretypes.py", line 779, in from_numpy_dtype
if np.issubdtype(dt, np.datetime64):
File "/home/ubuntu/miniconda/envs/my_env/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 388, in issubdtype
arg1 = dtype(arg1).type
TypeError: Cannot interpret 'CategoricalDtype(categories=['no', 'yes'], ordered=False)' as a data type
它无法解析第二列值。