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

6. Making Things Interactive with Bokeh

Activity 6.01: Plotting Mean Car Prices of Manufacturers

Solution:

  1. Create an Activity6.01.ipynb Jupyter notebook in the Chapter06/Activity6.01 folder.
  2. Import the necessary libraries:
    import pandas as pd
    from bokeh.io import output_notebook
    output_notebook()
  3. Load the automobiles.csv dataset from the Datasets folder:
    dataset = pd.read_csv('../../Datasets/automobiles.csv')
  4. Use the head method to print the first five rows of the dataset:
    dataset.head()

    The following figure shows the output of the preceding code:

Figure 6.36: Loading the top five rows of the automobile dataset

Plotting each car with its price

  1. Use the plotting interface of Bokeh to do some basic visualization first. Let's plot each car with its price. Import figure and show from the bokeh.plotting interface:
    from bokeh.plotting import figure, show
  2. First, use the index as our x-axis since we just want to plot each car with its price...
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 £16.99/month. Cancel anytime