I have a dictionary with labels and key as shown below.
country = pd.read_csv('assets/countries.csv')
country = country.set_index('Code')
country_options = [{'label': f'({cod}) {country.loc[cod, "Country"]} ',
'value': f'{cod}'} for cod in country.index]
[{‘label’: '(AFG) Afghanistan ', ‘value’: ‘AFG’}, {‘label’: '(ALB) Albania ', ‘value’: ‘ALB’}, {‘label’: '(DZA) Algeria '…
I also have a callback to update a graph and would like to add the title depending on the option selected from a dropdown list.
def update_graph(indi=indicator_options,coun=country_options):
df = indicator_select(coun, indi)
graph_content = dict(data=line_plot(df),
layout=go.Layout(
title=coun,
yaxis=dict(hoverformat='.1f'),
)
)
return graph_content
However, the title=coun will return me the 3 letter symbol (value) of the dict, but I need the label with the symbol and the name. Is it possible?