Hello experts,
I copy pasted the example code for the creation of a HeatMap found here in the Docs, but I get the following errors when I run python heatmap.py
(which is a file where I copy-pasted the code).
By the way, I need to plot a heatmap of a nxn matrix with positive real values between 0 and 1, is HeatMap the correct way to do that in Bokeh?
Many thanks,
Enrico Guiraud
Traceback (most recent call last):
File “heatmap.py”, line 8, in
hm = HeatMap(data, x=‘fruit’, y=‘sample’, values=‘fruit_count’, title=‘Fruits’, stat=None)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/builders/heatmap_builder.py”, line 92, in HeatMap
chart = create_and_build(HeatMapBuilder, data, xgrid=xgrid, ygrid=ygrid, **kw)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/builder.py”, line 67, in create_and_build
chart.add_builder(builder)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/chart.py”, line 149, in add_builder
builder.create(self)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/builder.py”, line 512, in create
self.process_data()
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/builders/heatmap_builder.py”, line 171, in process_data
columns=self.values.selection)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/attributes.py”, line 198, in setup
self.attr_map = self._create_attr_map(self.data.to_df(), self.columns)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/attributes.py”, line 168, in _create_attr_map
self._generate_items(df, columns)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/attributes.py”, line 249, in _generate_items
bin_count=len(self.iterable), aggregate=False)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/stats.py”, line 311, in init
super(Bins, self).init(**properties)
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/stats.py”, line 56, in init
self._refresh()
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/stats.py”, line 62, in _refresh
self.calculate()
File “/users/ml/ruft7045/.conda/envs/local/lib/python2.7/site-packages/bokeh/charts/stats.py”, line 344, in calculate
self.source.add(binned.tolist(), name=self.bin_column)
AttributeError: ‘Categorical’ object has no attribute ‘tolist’