This lesson is being piloted (Beta version)

Interactive Data Visualizations in Python

This workshop lesson is an introduction to making interactive data visualizations in Python. Learners will create a new environment using conda, wrangle data into the proper format using pandas library, create visualizations using the Plotly Python library, and display these visualizations and create widgets using Streamlit.

Preview the app

For a preview of what learners will be creating in this lesson (including the exercises), click the “Open in Streamlit” button below. Open in Streamlit The repository that contains this example Streamlit app can be found here.

Prerequisites

  1. Learners should have completed the Plotting and Programming in Python workshop lesson, or have some experience with Python and the pandas library.
  2. Learners should have Anaconda installed on their machines, as specified in the setup for Plotting and Programming in Python.
  3. Learners should be comfortable with using the command line and with using git, either on the command line or through an application like GitHub Desktop.
  4. Learners should have a Jupyter Lab & Streamlit compatible web browser installed (Google Chrome, Firefox, or Safari).
  5. Learners should have downloaded the required files (data_viz_workshop.zip) as specified in the Setup
  6. Learners should have a GitHub account if they wish to deploy (share) their app.

Schedule

Setup Download files required for the lesson
00:00 1. Why make interactive visualizations? Why are visual representations of data useful when trying to see patterns?
Why do we want to make visualizations interactive?
Consider the message you want to convey or story you want to tell. Is it clearer with some interactivity?
00:10 2. Create a New Environment How can I create a new conda environment?
00:30 3. Data Wrangling What format should my data be in for Plotly Express?
Why can’t I use the data in its current format?
What is tidy data?
How can I use pandas to wrangle my data?
00:50 4. Create Visualizations How can I create an interactive visualization using Plotly Express?
01:10 5. Create the Streamlit App How do I create a Streamlit app?
How can I see a live preview of my app?
01:30 6. Refactoring Code for Flexibility (Prepping for Widgets) How does the current code need to change in order to incorporate widgets?
What aspects of the code need to change?
What does it mean to ‘refactor’ code?
01:55 7. Add Widgets to the Streamlit App Why do I want to have widgets in my app?
What kinds of widgets are there?
How can I use widgets to alter my plot?
02:25 8. Publish Your Streamlit App How do I deploy my app so other people can see it?
How do I create a requirements.txt file?
03:15 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.