Reputation: 815
I have a Blaze dataframe df
which looks like this:
I'm trying to make a bar chart in bokeh with overall
as the x-axis range, aggregated over the wordcount
column.
This is the code that I tried:
from bokeh.charts import Bar, show
from bokeh.io import output_notebook
p = Bar(df,"overall",values = "wordcount",title="Bar Plot")
output_notebook()
show(p)
But I'm getting an error as follows:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-6670bae09dbd> in <module>()
2 from bokeh.io import output_notebook
3
----> 4 p = Bar(df,"overall",values = "wordcount",title="Bar Plot")
5
6 output_notebook()
/home/anaconda2/lib/python2.7/site-packages/bokeh/charts/builders/bar_builder.pyc in Bar(data, label, values, color, stack, group, agg, xscale, yscale, xgrid, ygrid, continuous_range, **kw)
319 kw['y_range'] = y_range
320
--> 321 chart = create_and_build(BarBuilder, data, **kw)
322
323 # hide x labels if there is a single value, implying stacking only
/home/anaconda2/lib/python2.7/site-packages/bokeh/charts/builder.pyc in create_and_build(builder_class, *data, **kws)
66 # create the new builder
67 builder_kws = {k: v for k, v in kws.items() if k in builder_props}
---> 68 builder = builder_class(*data, **builder_kws)
69
70 # create a chart to return, since there isn't one already
/home/anaconda2/lib/python2.7/site-packages/bokeh/charts/builder.pyc in __init__(self, *args, **kws)
292 # make sure that the builder dimensions have access to the chart data source
293 for dim in self.dimensions:
--> 294 getattr(getattr(self, dim), 'set_data')(data)
295
296 # handle input attrs and ensure attrs have access to data
/home/anaconda2/lib/python2.7/site-packages/bokeh/charts/properties.pyc in set_data(self, data)
170 data (`ChartDataSource`): the data source associated with the chart
171 """
--> 172 self.selection = data[self.name]
173 self._chart_source = data
174 self._data = data.df
TypeError: 'NoneType' object has no attribute '__getitem__'
Can anyone help me out with this?
Upvotes: 0
Views: 107