☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

ColumnDataSource constructor

Community Support
Alex_Rice
Alex_Rice

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

⌁   Link to post
James_Yu
James_Yu

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] }

⌁   Link to post
Daniel_Krause
Daniel_Krause

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

Daniel

···

Am 29.12.2016 6:12 nachm. schrieb “Alex Rice” rice.guido@gmail.com:

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Alex_Rice
Alex_Rice

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 <bokeh@continuum.io> wrote:

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

Daniel

Am 29.12.2016 6:12 nachm. schrieb "Alex Rice" <rice.guido@gmail.com>:

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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post

End of archived discussion · Replies are disabled