Auto (or max) height for DataTable

I have this sample script

import pandas as pd
from bokeh.models.widgets import DataTable, TableColumn
from bokeh.models.widgets import NumberFormatter, DateFormatter
from bokeh.models.sources import ColumnDataSource
from bokeh.layouts import column
from bokeh.embed import file_html
from bokeh.resources import CDN
import datetime![sscreen|448x500](upload://ukBekSoafQOuN96vsd7JfXcyHu0.png) 

N  = 5
df = pd.DataFrame([[datetime.date(2020,7,i+1), i % 5] for i in range(N)], columns=['Date','Number'])
formats = {'Date': DateFormatter(), 'Number': NumberFormatter(format='0,0.', text_align='right')}
cols        = [TableColumn(field=col, title=col, formatter=formats[col]) for col in df.columns]
data_table1 = DataTable(columns=cols, source=ColumnDataSource(df), sizing_mode="scale_both", fit_columns=True)
data_table2 = DataTable(columns=cols, source=ColumnDataSource(df), fit_columns=True)
html = file_html(column(data_table1, data_table2), CDN, "my plot")
with open('dasdas.html', 'w') as f:
    f.write(html)

which gives an output with a lot of whitespace between the 2 tables. How can this white space be reduced? For example, by auto-adjusting the height of table 1 or setting a max height?

1 Like