Book Image

The Data Visualization Workshop

By : Mario Döbler, Tim Großmann
Book Image

The Data Visualization Workshop

By: Mario Döbler, Tim Großmann

Overview of this book

Do you want to transform data into captivating images? Do you want to make it easy for your audience to process and understand the patterns, trends, and relationships hidden within your data? The Data Visualization Workshop will guide you through the world of data visualization and help you to unlock simple secrets for transforming data into meaningful visuals with the help of exciting exercises and activities. Starting with an introduction to data visualization, this book shows you how to first prepare raw data for visualization using NumPy and pandas operations. As you progress, you’ll use plotting techniques, such as comparison and distribution, to identify relationships and similarities between datasets. You’ll then work through practical exercises to simplify the process of creating visualizations using Python plotting libraries such as Matplotlib and Seaborn. If you’ve ever wondered how popular companies like Uber and Airbnb use geoplotlib for geographical visualizations, this book has got you covered, helping you analyze and understand the process effectively. Finally, you’ll use the Bokeh library to create dynamic visualizations that can be integrated into any web page. By the end of this workshop, you’ll have learned how to present engaging mission-critical insights by creating impactful visualizations with real-world data.
Table of Contents (9 chapters)
7. Combining What We Have Learned

4. Simplifying Visualizations Using Seaborn

Activity 4.01: Using Heatmaps to Find Patterns in Flight Passengers' Data


Find the patterns in the flight passengers' data with the help of a heatmap:

  1. Create an Activity4.01.ipynb Jupyter notebook in the Chapter04/Activity4.01 folder to implement this activity.
  2. Import the necessary modules and enable plotting within a Jupyter notebook:
    %matplotlib inline
    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    import seaborn as sns
  3. Use pandas to read the flight_details.csv dataset located in the Datasets folder. The given dataset contains the monthly figures for flight passengers for the years 1949 to 1960:
    data = pd.read_csv("../../Datasets/flight_details.csv")
  4. Now, we can use the pivot() function to transform the data into a format that is suitable for heatmaps:
    data = data.pivot("Months", "Years", "Passengers")
    data = data.reindex...