I've been working with the bokeh/datashader dashboard in python 3.6.X developing some additional functionality into the dashboard project. When the project is executed in a 3.5.2 Python environment I run into a TypeError: data type not understood
during creation of an aggregate that is not present in the 3.6.X execution.
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))
with x_field
and y_field
as float64
web-Mercator longitude, latitude fields from a Pandas DataFrame and time_start
and time_end
as float64
values as is the DF['time_position']
field.
A simple test with method as Canvas.line
agg = method(self.df, x_field, y_field, ds.count_cat(agg_field))
removing the df (DataFrame) indexing request yields:
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
What it looks like as I step through all of this is that it can't recognize the datatype of the pandas data series??? Any help would be appreciated, hopefully in the form of a work-around that is viable for both 3.5 and 3.6 Python environments.
Relevant Environment: Python 3.5.2 DataShader 0.6.2dev3