hi, I need to search in an np.array, and I’m using dropdowns, so, I need to know what is the possition of the array. Is there any way to know that?
dcc.Dropdown(
options=[
{'label': 'New York City', 'value': 'New York City'},
{'label': 'Montreal', 'value': 'Montreal'},
{'label': 'San Francisco', 'value': 'San Francisco'},
],
value='Montreal'
)
Label for idx/position, and value for option. Does this work for you?
sorry … I’ve explained wrongly … I meant number (index number)
You must encode the information you need (e.g. the index) as (part of) the value
property, e.g.
dcc.Dropdown(
options=[
{'label': 'New York City', 'value': 0}, # value is the index
{'label': 'Montreal', 'value': 1}, # value is the index
{'label': 'San Francisco', 'value': 2}, # value is the index
],
value=1 # select Montreal
)
and if I dont know the labels? (I’m changing of data a lot of times … I need to index without knowing labels