Black Lives Matter. Please consider donating to Black Girls Code today.

How to update selecting Dropdown list from Pandas using callback option

Hello Community,

I have been stuck for couple of days trying to solve one issue.
I have successfully taken the data from the web using pandas and stored the list into
NAME as ‘name’ and CODE as ‘code’ and combined name and code as
ds= ‘name’ + ’ ’ + ‘(’ + ‘code’ + ‘)’

So, dropdown is completed.

However I’m stuck how to connect using the ‘name’ for subplots

There are 3 different subplots I made
and those subplots are all connected to one command as below.
스크린샷 2020-02-19 오후 3.24.19

I still do not know how to pass the ‘name’ selected from dropdown to the item_name below.
BTW, the ‘def get_code()’ is in with all other def codes.
and will it automatically update when the item from dropdown is selected? (second question)
def get_code():
code_df = get_codedf()
item_name = ‘name1’
code_url = get_url(item_name, code_df)
return code_url

getcodedf() in the code is where ‘name’ and ‘code’ list are stored in two different lists
and using the item name, get_url() will find the code and input into a web url
and that url will start bunch of codes to send the data to 3 different plots.

If I designate the item_name it shows the plots perfectly
but I don’t know how to connect them with the dropdown I have created

Can anyone be so kind to help me out here?
Best if you can make a code out of the ones I have
or a sample project will be a great help.


Hi @Eon
Have you tried connecting the two, using the callback decorator ?

@adamschroeder Hello
I do not know how to connect it.
How do I let the dropdown be assigned to ‘name’ only
and callback to send the value to
def get_chart(value) ?

can u share some exampleS?

Hi @Eon
I’m not sure how you’re trying to use the “def get_code()” function but this video I created explains how to tie the dropdown to the dcc.graph, using a callback.