Frozen_columns in data table not working


I am trying to create a data table that has first column frozen when I scroll to the right. There is the attribute, frozen_columns in the documentation but I get an attribute error when I add it in there. Otherwise the table works fine, the first column is just not frozen.

Here is my code:

source = ColumnDataSource(trend.iloc[:-1])

columns = [TableColumn(field=x, title=x) for x in trend.columns]

death_percentages_per_week = DataTable(source=source, columns=columns, width=1200, height=400, fit_columns = False, frozen_columns = 1)

This is the error I get:

AttributeError: unexpected attribute ‘frozen_columns’ to DataTable, similar attributes are fit_columns or columns

Did this attribute get removed?


Are you looking at the documentation version that corresponds to the package version you have installed? IIRC frozen_columns is a recent addition, so if your installed version of Bokeh is older than that, you would need to upgrade to use it.

You can upgrade by just using pip install bokeh, correct?

I mostly use conda. I think with pip you may need to specify --upgrade if you want to upgrade in an existing env that already has Bokeh installed.

That fixed it. Thanks Bryan!

1 Like