Bokeh: Better error message for non-float data types with TimeSeries

Created on 18 Feb 2016  路  4Comments  路  Source: bokeh/bokeh

from decimal import Decimal
import numpy as np
import pandas as pd
from bokeh.charts import TimeSeries

df = pd.DataFrame(np.random.randn(10,3), columns=['A', 'B', 'C'])
TimeSeries(df.applymap(Decimal))

Results in the unhelpful error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-111-6fa93c5b2286> in <module>()
----> 1 TimeSeries(df.applymap(Decimal))

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\builders\timeseries_builder.py in TimeSeries(data, x, y, builder_type, **kws)
    100     kws['x'] = x
    101     kws['y'] = y
--> 102     return create_and_build(builder_type, data, **kws)

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\builder.py in create_and_build(builder_class, *data, **kws)
     65     chart_kws = { k:v for k,v in kws.items() if k not in builder_props}
     66     chart = Chart(**chart_kws)
---> 67     chart.add_builder(builder)
     68     chart.start_plot()
     69 

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\chart.py in add_builder(self, builder)
    150     def add_builder(self, builder):
    151         self._builders.append(builder)
--> 152         builder.create(self)
    153 
    154     def add_ranges(self, dim, range):

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\builder.py in create(self, chart)
    516         if chart is None:
    517             chart = Chart()
--> 518         chart.add_renderers(self, renderers)
    519 
    520         # handle ranges after renders, since ranges depend on aggregations

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\chart.py in add_renderers(self, builder, renderers)
    145 
    146     def add_renderers(self, builder, renderers):
--> 147         self.renderers += renderers
    148         self._renderer_map.extend({ r._id : builder for r in renderers })
    149 

C:\Python\envs\py-dev\lib\site-packages\bokeh\core\property_containers.py in wrapper(*args, **kwargs)
     16         self = args[0]
     17         old = self._saved_copy()
---> 18         result = func(*args, **kwargs)
     19         self._notify_owners(old)
     20         return result

C:\Python\envs\py-dev\lib\site-packages\bokeh\core\property_containers.py in __iadd__(self, y)
     75     @notify_owner
     76     def __iadd__(self, y):
---> 77         return super(PropertyValueList, self).__iadd__(y)
     78 
     79     # x *= y

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\builders\line_builder.py in yield_renderers(self)
    240                 yield renderer
    241 
--> 242         Stack().apply(self.comp_glyphs)
    243         Dodge().apply(self.comp_glyphs)
    244 

C:\Python\envs\py-dev\lib\site-packages\bokeh\charts\models.py in apply(self, renderers)
    194         else:
    195             raise AttributeError('%s must be applied to available renderers, none found.' %
--> 196                                  self.__class__.__name__)

AttributeError: Stack must be applied to available renderers, none found.
duplicate bug

Most helpful comment

+1 for this. I recently ran into this problem and thankfully a quick Google search sent me here. The error in my particular case was AttributeError: Dodge must be applied to available renderers, none found. Fixed this issue by converting the data into float type after reading this post.

All 4 comments

+1 for this. I recently ran into this problem and thankfully a quick Google search sent me here. The error in my particular case was AttributeError: Dodge must be applied to available renderers, none found. Fixed this issue by converting the data into float type after reading this post.

@damianavila - is there anything that needs to be discussed? I think this should really be labelled a bug to get better visibility since if bokeh isn't to automatically support non-float types it should fail with an informative rather than misleading error.

I think this should really be labelled a bug to get better visibility since if bokeh isn't to automatically support non-float types it should fail with an informative rather than misleading error.

You are probably correct... not doing Bokeh work right now, but let's ping @bryevdv who will give you a better (updated) feedback. In the mean time, relabeling as bug...

moved to bkcharts repo

Was this page helpful?
0 / 5 - 0 ratings