Some of the features used in this tutorial require a paid plan. If you don’t have a paid plan, don’t worry - just follow the tutorial and click Start Trial when prompted.

Build an interactive dashboard from a CSV dataset

In this tutorial, we’re going to build an interactive dashboard to display insights from a CSV dataset. We’re going to be using a dataset of Uber pickups in New York City. We’ll use Anvil’s Data Files service to upload and store our CSV file, so that it is easily accessible from our app’s code. We will also be using pandas to read our data and Plotly to turn our data into interactive plots.

The final app will look something like this:

Screenshot of the finished dashboard app

You can test it out here: uber-pickups-example.anvil.app

We’ll build the app in 7 quick steps:

  1. We’ll first import the dataset and Python packages we need.
  2. Second, we’ll create the app’s UI with Anvil’s drag-and-drop designer.
  3. Next, we’ll examine our data to better understand how to use it.
  4. We’ll then use numpy and Plotly to create and plot a histogram of all pickups per hour.
  5. We’ll next plot the location data onto an interactive map using Mapbox and Plotly.
  6. To finish the app, we’ll allow users to filter the data displayed on the map.
  7. Finally, we’ll publish our app and share it with the world!

You can download the source code for the finished app here:

Chapters

In this tutorial, you'll:

Build the user interface

Drag and drop components to create the app’s user interface.

Create a histogram

Use numpy to create a histogram out of the data/time data.

Plot the map data

Plot the location data onto a Scattermapbox Plotly plot.

Respond to user input

Modify the app so that it updates based on user input.