我一直在使用 python 3.6.X 中的散景/数据着色器仪表板为仪表板项目开发一些附加功能。当项目在 3.5.2 Python 环境中执行时,我TypeError: data type not understood
在创建 3.6.X 执行中不存在的聚合期间遇到了。
agg = method(self.df[(self.df['time_position'] >= time_start) & (self.df['time_position'] <= time_end)
| (self.df['time_position'].isnull())], x_field, y_field, ds.count_cat(agg_field))
使用x_field
和y_field
作为 float64
web-Mercator 经度,来自 Pandas DataFrame 的纬度字段,time_start
以及time_end
作为字段的float64
值DF['time_position']
。
使用 Canvas.line 方法进行的简单测试
agg = method(self.df, x_field, y_field, ds.count_cat(agg_field))
删除 df (DataFrame) 索引请求会产生:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-3-c9d8810a25e0>", line 1, in <module>
agg = method(self.df, x_field, y_field, ds.count_cat(agg_field))
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashader\core.py", line 202, in line
return bypixel(source, self, Line(x, y), agg)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashader\core.py", line 410, in bypixel
dshape = dshape_from_pandas(src)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashader\utils.py", line 344, in dshape_from_pandas
for k in df.columns])
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashader\utils.py", line 344, in <listcomp>
for k in df.columns])
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashader\utils.py", line 334, in dshape_from_pandas_helper
dshape = datashape.CType.from_numpy_dtype(col.dtype)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\datashape\coretypes.py", line 781, in from_numpy_dtype
if np.issubdtype(dt, np.datetime64):
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\envs\TrendingAnalysis_GUI_python352\lib\site-packages\numpy\core\numerictypes.py", line 755, in issubdtype
return issubclass(dtype(arg1).type, arg2)
TypeError: data type not understood
当我逐步完成所有这些时,它看起来是它无法识别 pandas 数据系列的数据类型???任何帮助都将不胜感激,希望以对 3.5 和 3.6 Python 环境都可行的解决方法的形式出现。
相关环境:Python 3.5.2 DataShader 0.6.2dev3