Hi, I’m trying to create a dropdown menu which selects data from a pandas dataframe. A callback takes the value of the dropdown menu as an input and calculates the minimum and maximum points for a rangeslider. This should be passed as an output. I tried 2 different methods. First I tried to pass the ‘min’ and ‘max’ directly in the callback. However, these are python reserved keywords, so the code throws an error.
@app.callback(Output('slider-keeper', ['min','max','value']),[Input('select-assumption', 'value')])
def update_slider_example(input):
min_value = min(df_data_FW[input])
max_value = min(df_data_FW[input])
return {min=min_value, max=max_valuem, value = [min_value,max_value]}
Next I tried to pass the range slider component to a html div.
@app.callback(Output('slider-keeper', 'children'),[Input('select-assumption', 'value')])
def update_slider_example(input):
min_value = min(df_data_FW[input])
max_value = min(df_data_FW[input])
return dcc.RangeSlider(
id='range-slider',
min=min_value,
max=max_value,
value=[min_value, max_value],
)
The code runs, however the app seems to be stalled during updating. It should be noted that I have other components which depends on the value of the range slider. I hope you can help to come up with a solution to this problem. Thanks you in advance.