From the course: Interactive Dashboards with Plotly and Dash

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Demo: Dropdowns

Demo: Dropdowns

- Okay, so let's go ahead and build a simple Dash app, shall we? We can use our Jupyter Dash function just to keep things in our notebook. We're going to open up an HTML div and then within that div, we're going to have a dropdown menu with the ID filter, just two options here. And the default value is going to be California. And note that we can even wrap single values in a list and it will be valid. So we'll just keep it like this because I'm going to change things later. We also have a graph, and so the values selected in our dropdown gets passed into our callback function. And so state is going to be California to start. And so what we're going to do is use the query method to filter our education data frame. If the row in our data frame has a value that is in the list, so right now this is just California, then we'll keep that row in our data frame, otherwise it'll be excluded. We're also filtering down to this range of years before grouping by year, summing, and then just making…

Contents