ColumnDataSource constructor

Hi all, I have a super easy question for you. Why does this script fail with
"ValueError: expected an element of Dict(String, Seq(Any)), got {'w': 4}" ?

from bokeh.models import ColumnDataSource

d = {'x' : 1, 'y' : 2, 'h' : 3, 'w' : 4 }
ds = ColumnDataSource(d)

That is basically the same as the ColumnDataSource usage here, and in
various other examples.

https://github.com/bokeh/bokeh/blob/master/tests/glyphs/Rect.py

So I am kind of confused- thanks in advance.

Alex

ColumnDataSource expects an argument of a dictionary of sequences. You have a dictionary of ints. To get it working, you can write something like this…
d = {‘x’ : [1], ‘y’ : [2], ‘h’ : [3], ‘w’ : [4] }

It should work if the values are set as list:
‘W’: [4]

Daniel

···

Am 29.12.2016 6:12 nachm. schrieb “Alex Rice” [email protected]:

Hi all, I have a super easy question for you. Why does this script fail with

“ValueError: expected an element of Dict(String, Seq(Any)), got {‘w’: 4}” ?

from bokeh.models import ColumnDataSource

d = {‘x’ : 1, ‘y’ : 2, ‘h’ : 3, ‘w’ : 4 }

ds = ColumnDataSource(d)

That is basically the same as the ColumnDataSource usage here, and in

various other examples.

https://github.com/bokeh/bokeh/blob/master/tests/glyphs/Rect.py

So I am kind of confused- thanks in advance.

Alex

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACmK6Bt5cLLom_b%3DbKcJwBoxe9HoJbfDaY2epLW3s923JyjzXA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks James, and Daniel. I was hung up looking at the
tests/glyphs/Rect.py and not paying enough attention to the error
message :slight_smile:

···

On Thu, Dec 29, 2016 at 10:31 AM, 'Daniel Krause' via Bokeh Discussion - Public <[email protected]> wrote:

It should work if the values are set as list:
'W': [4]

Daniel

Am 29.12.2016 6:12 nachm. schrieb "Alex Rice" <[email protected]>:

Hi all, I have a super easy question for you. Why does this script fail
with
"ValueError: expected an element of Dict(String, Seq(Any)), got {'w': 4}"
?

from bokeh.models import ColumnDataSource

d = {'x' : 1, 'y' : 2, 'h' : 3, 'w' : 4 }
ds = ColumnDataSource(d)

That is basically the same as the ColumnDataSource usage here, and in
various other examples.

https://github.com/bokeh/bokeh/blob/master/tests/glyphs/Rect.py

So I am kind of confused- thanks in advance.

Alex

--
You received this message because you are subscribed to the Google Groups
"Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACmK6Bt5cLLom_b%3DbKcJwBoxe9HoJbfDaY2epLW3s923JyjzXA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups
"Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAMiLiKhkxrxcJMK4cB2VbzzhnipLRTXBVWVUzHz6hycR5dZXsw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.