Trying to run iris scatter notebook example using Bokeh .8 getting errors

using this notebook http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/exercises/charts/scatter.ipynb
And ipython notebook (dev3.0)

I get: the 1st cell says Bokeh loaded successfully.

the next attempt to plot using the dict:

#Using an OrderedDict as input

xyvalues = OrderedDict([(“setosa”, setosa.values), (“versicolor”, versicolor.values), (“virginica”, virginica.values)])

scatter = Scatter(xyvalues)

scatter.title(“iris dataset, dict_input”).xlabel(“petal_length”).ylabel(“petal_width”).legend(“top_left”).width(600).height(400).notebook().show()

gives:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-65aa6c8962f0> in <module>()
      2 xyvalues = OrderedDict([("setosa", setosa.values), ("versicolor", versicolor.values), ("virginica", virginica.values)])
      3 scatter = Scatter(xyvalues)
----> 4 scatter.title("iris dataset, dict_input").xlabel("petal_length").ylabel("petal_width").legend("top_left").width(600).height(400).notebook().show()

TypeError: 'NoneType' object is not callable

the DF approach:

import pandas as pd
#Using a DataFrame as input
xyvalues = OrderedDict([("setosa", setosa), ("versicolor", versicolor), ("virginica", virginica)])
df = pd.concat(xyvalues, axis=1, names=["l0", "l1"])
scatter = Scatter(df)
scatter.title("iris dataset, df_input").legend("top_left").width(600).height(400).notebook().show()


which gives:

<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-3-3c3416381a7f> in <module>()
      5 df = pd.concat(xyvalues, axis=1, names=["l0", "l1"])
      6
----> 7 scatter = Scatter(df)
      8 scatter.title("iris dataset, df_input").legend("top_left").width(600).height(400).notebook().show()

/usr/local/lib/python2.7/dist-packages/bokeh/charts/builder/scatter_builder.pyc in Scatter(values, **kws)
     71
     72     """
---> 73     return create_and_build(ScatterBuilder, values, **kws)
     74
     75 class ScatterBuilder(Builder):

/usr/local/lib/python2.7/dist-packages/bokeh/charts/_builder.pyc in create_and_build(builder_class, values, **kws)
     38     chart_kws = { k:v for k,v in kws.items() if k not in builder_props}
     39     chart = Chart(**chart_kws)
---> 40     chart.add_builder(builder)
     41
     42     return chart

/usr/local/lib/python2.7/dist-packages/bokeh/charts/_chart.pyc in add_builder(self, builder)
    113     def add_builder(self, builder):
    114         self._builders.append(builder)
--> 115         builder.create(self)
    116
    117         # Add tools if supposed to

/usr/local/lib/python2.7/dist-packages/bokeh/charts/_builder.pyc in create(self, chart)
    161     def create(self, chart=None):
    162         self._adapt_values()
--> 163         self._process_data()
    164         self._set_sources()
    165         renderers = self._yield_renderers()

/usr/local/lib/python2.7/dist-packages/bokeh/charts/builder/scatter_builder.pyc in _process_data(self)
    101         self._groups.extend(self._values.keys())
    102         # Grouping
--> 103         self.parse_data()
    104
    105     @property

/usr/local/lib/python2.7/dist-packages/bokeh/charts/builder/scatter_builder.pyc in _parse_data(self)
    135             xy = self._values[val]
    136             for value in self._values.index:
--> 137                 x_.append(xy[value][0])
    138                 y_.append(xy[value][1])
    139

IndexError: invalid index to scalar variable.

Hi,

From the traceback I assume you are using bokeh 0.8. Charts interface have changed after 0.8 release and chained methods are not supported as in the previous versions. My best guess without more details is that you seem to be running an old example with the new version. Can you try with the updated examples that you can find here: https://github.com/bokeh/bokeh/tree/master/examples/charts/notebook ?

Thank you

···

Fabio Pliger

Thank you for the quick response that notebook works fine!

···

On Thursday, February 19, 2015 at 12:16:42 PM UTC-6, Fabio Pliger wrote:

Hi,

From the traceback I assume you are using bokeh 0.8. Charts interface have changed after 0.8 release and chained methods are not supported as in the previous versions. My best guess without more details is that you seem to be running an old example with the new version. Can you try with the updated examples that you can find here: https://github.com/bokeh/bokeh/tree/master/examples/charts/notebook ?

Thank you


Fabio Pliger