The problem should lie in the callback function. Unfortunately, I have no experience in JS. I took this part from the dataframe-js library but it is not working. The idea is to have a dashboard with two graphs for Rate1 and Rate2 and a dropdown menu for the categories for both Rates.
import pandas as pd
from bokeh.models import ColumnDataSource, CustomJS, Select
from bokeh.plotting import figure, output_file
from bokeh.layouts import gridplot
from bokeh.io import show
d = {'Category': ['Cat1', 'Cat2', 'Cat3', 'Cat1', 'Cat2', 'Cat3', 'Cat1', 'Cat2', 'Cat3'],
'Rate1': [1, 4, 3, 3, 7, 4, 9, 2, 6], 'Rate2': [3, 4, 6, 1, 9, 6, 8, 2, 1],
'Date': ['2021-06-21', '2021-06-21', '2021-06-21', '2021-06-22', '2021-06-22', '2021-06-22', '2021-06-23', '2021-06-23', '2021-06-23']}
df = pd.DataFrame(data=d)
output_file("with_dropdown_list.html")
category_default = "Cat1"
unique_categories = list(df.Category.unique())
source = ColumnDataSource(data={'y1': df.loc[df['Category'] == category_default].Rate1,
'y2': df.loc[df['Category'] == category_default].Rate2,
'date': df.loc[df['Category'] == category_default].Date})
output_file("time_series.html")
s1 = figure(title=category_default, x_axis_type="datetime", plot_width=500, plot_height=500)
s1.line(y='y1', x='date', source=source)
s2 = figure(title=category_default, x_axis_type="datetime", plot_width=500, plot_height=500)
s2.line(y='y2', x='date', source=source)
callback1 = CustomJS(args = {'source': source, 'data': data},
code = """source.data['y1'] = data['y1'].filter(row => row.get('Category') == cb_obj.value);""")
callback2 = CustomJS(args = {'source': source, 'data': data},
code = """source.data['y2'] = data['y2'].filter(row => row.get('Category') == cb_obj.value);""")
select1 = Select(title='Category Selection', value=category_default, options=unique_categories)
select1.js_on_change('value', callback1)
select2 = Select(title='Category Selection', value=category_default, options=unique_categories)
select2.js_on_change('value', callback2)
p = gridplot([[s1, s2], [select1, select2]])
show(p)