From the course: Data Visualization in Python with Dash

Unlock the full course today

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

Using callbacks to power drop-down menus

Using callbacks to power drop-down menus - Python Tutorial

From the course: Data Visualization in Python with Dash

Using callbacks to power drop-down menus

- In this video, we're going to look at how to use a callback, to update the graph based on which metal is selected. Before we dive into the callback, though, we just need to make a couple of changes to our code. First of all, you see here on line eight, we have used calls, DateTime, and Gold. We no longer want that because that was limiting our data to just the gold values. So now, if you look down on line 62, here, you can see we're using this dictionary comprehension, which is now going through data dot columns, all but the first one. So if you look at the CSV, let's just get some orientation here. The CSV containing the data has a column called DateTime, which we're not interested in. All the other columns are the metal names, and those are going to be what we want for our options for our dropdown. Now, we also need to import a couple of dependencies. These are specific to using the callback. So from dash dot…

Contents