INNER CODE UNIT · Python
update
burkesquires/python_biologist · 06_data_vis_python/bokeh/server/app/export_csv/main.py:19
def update():
current = df[(df['salary'] >= slider.value[0]) & (df['salary'] <= slider.value[1])].dropna()
source.data = {
'name' : current.name,
'salary' : current.salary,
'years_experience' : current.years_experience,
}
slider = RangeSlider(title="Max Salary", start=10000, end=110000, value=(10000, 50000), step=1000, format="0,0")
slider.on_change('value', lambda attr, old, new: update())
button = Button(label="Download", button_type="success")
button.js_on_event(
"button_click",
CustomJS(
args=dict(source=source),
code=(Path(__file__).parent / "download.js").read_text("utf8"),
),