我在弄清楚的时候就知道了。将列表放入数据框。
df= pd.DataFrame({
'c' : list
})
为下拉菜单编码
dcc.Dropdown(
id='dropdown',
options=[
{'label':i, 'value':i} for i in df['c'].unique()
],
),
html.Div(id='output')
回叫
@app.callback(Output('output', 'children'),
[Input('dropdown', 'value')])
def update_output_1(value):
filtered_df = df[df['c'] == value]
return filtered_df.iloc[0]['c']