Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Data Visualization Workshop

You're reading from   The Data Visualization Workshop A self-paced, practical approach to transforming your complex data into compelling, captivating graphics

Arrow left icon
Product type Paperback
Published in Jul 2020
Publisher Packt
ISBN-13 9781800568846
Length 536 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Mario Döbler Mario Döbler
Author Profile Icon Mario Döbler
Mario Döbler
Tim Großmann Tim Großmann
Author Profile Icon Tim Großmann
Tim Großmann
Arrow right icon
View More author details
Toc

4. Simplifying Visualizations Using Seaborn

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

Solution:

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
    sns.set()
  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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime