I have the following function:
def origin_func():
return html.Div( children=[ dcc.Markdown('Select country'), dcc.Dropdown( id='origin_div', options=[{'label': 'Malta', 'value': './data/malta.csv'}, {'label': 'Japan', 'value': './data/japan.csv'}], value='./data/malta.csv' ) ] )
That allows associating a country with a file path (html.Div(children=[origin_func()])
).
Now, I’d would like to use this path to load a Pandas Dataframe through a callback
@app.callback(
Output(‘path’, ‘children’),
Input(‘origin_div’, ‘value’)
But I cannot find how to load the Dataframe (df = pd.read_csv('path')
) into th function
def destination_func():
return html.Div(
children=[
dcc.Markdown('Select country of destination'),
dcc.Dropdown(
id='destination_div',
options=[{'label': i, 'value': i} for i in df['Destination'].drop_duplicates()],
value=df['Destination'].drop_duplicates()[0]
)
]
)
6 posts - 2 participants