☰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

A General Question About ColumnDataSource

Community Supportbokeh
Gen
Gen

Just a general question regarding Pandas DataFrame vs ColumnDataSource in the context of bokeh.

Are there any pros/cons for using a DataFrame directly in a call vs using a ColumnDataSource?

For example, I have a variable df which stores a DataFrame:

p = figure(source = df)
OR

source = ColumnDataSource(df)
p = figure(source=source)

Do I gain anything by doing the second call? I’ve seen many examples of both, so I wanted to create a standard for my project

⌁   Link to post
Bryan
Bryan

There is always a ColumnDataSource. If you pass a pandas data frame then Bokeh just creates one for you behind the scenes as a convenience. Creating a CDS yourself is useful if you want to share one data source between different plots or glyphs, refer to the data source in JS callbacks or other contexts, or have more control over which columns are in the data source.

⌁   Link to post

End of archived discussion · Replies are disabled