Официально не поддерживается, но вы можете просто назначить новые столбцы для вашей таблицы следующим образом (работает для Bokeh v1.0.4). Запустить с bokeh serve --show app.py
from random import random
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource, DataTable, TableColumn, StringEditor, IntEditor, NumberEditor
source = ColumnDataSource(dict(index = [0], NAME = ["bar"], ID = [1], S1 = [2]))
original_columns = [
TableColumn(field = "NAME", title = "Name", editor = StringEditor(), name = 'custom_header_name'),
TableColumn(field = "ID", title = "ID", editor = IntEditor()),
TableColumn(field = "S1", title = "Value", editor = NumberEditor()) ]
modyfied_columns = [
TableColumn(field = "NAME", title = "Foo", editor = StringEditor(), name = 'custom_header_name'),
TableColumn(field = "ID", title = "Bar", editor = IntEditor()),
TableColumn(field = "S1", title = "Oeps", editor = NumberEditor()) ]
data_table = DataTable(source = source, width = 1000, height = 80, columns = original_columns)
data_table.height = 2000
i = 0
def update_data():
global i, data_table, original_columns
if i % 2 == 0:
data_table.columns = modyfied_columns
else:
data_table.columns = original_columns
NAME, ID, S1 = "foo", i, random()
i += 1
data = dict(index = [i], NAME = [NAME], ID = [ID], S1 = [S1])
source.stream(data, 500)
curdoc().add_root(data_table)
curdoc().add_periodic_callback(update_data, 500)
Результат;