0

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

  • Are you sure that your py35 and py36 environments are comparable? In particular, are the xarray and pandas versions the same between the two? It would be helpful to report those version numbers in each case, and also to try the latest Datashader release (0.6.4). – James A. Bednar Dec 08 '17 at 21:45
  • A pandas update for the 3.5.2 environment was all that was required. It's working as intended in both environments right now. – Daniel Homer Dec 11 '17 at 14:32
  • Glad to hear it! Let us know which version of pandas was needed so that we can pin that as the required version. – James A. Bednar Dec 12 '17 at 14:40
  • pandas/_verion.py from the working Python 3.5.2 states "version": "0.20.3" with the "full-revisionid": "3a7f956c30528736beaae5784f509a76d892e229". With the pandas update, the dev3 version of DataShader is still completely functional. – Daniel Homer Dec 12 '17 at 16:44
  • Ok, we'll pin to pandas 0.20.3 or later. Thanks! – James A. Bednar Dec 14 '17 at 17:08

0 Answers0