Interactive Data Visualization with Python
eBook - ePub

Interactive Data Visualization with Python

Present your data as an effective and compelling story, 2nd Edition

  1. 362 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Interactive Data Visualization with Python

Present your data as an effective and compelling story, 2nd Edition

About this book

Create your own clear and impactful interactive data visualizations with the powerful data visualization libraries of Python

Key Features

  • Study and use Python interactive libraries, such as Bokeh and Plotly
  • Explore different visualization principles and understand when to use which one
  • Create interactive data visualizations with real-world data

Book Description

With so much data being continuously generated, developers, who can present data as impactful and interesting visualizations, are always in demand. Interactive Data Visualization with Python sharpens your data exploration skills, tells you everything there is to know about interactive data visualization in Python.

You'll begin by learning how to draw various plots with Matplotlib and Seaborn, the non-interactive data visualization libraries. You'll study different types of visualizations, compare them, and find out how to select a particular type of visualization to suit your requirements. After you get a hang of the various non-interactive visualization libraries, you'll learn the principles of intuitive and persuasive data visualization, and use Bokeh and Plotly to transform your visuals into strong stories. You'll also gain insight into how interactive data and model visualization can optimize the performance of a regression model.

By the end of the course, you'll have a new skill set that'll make you the go-to person for transforming data visualizations into engaging and interesting stories.

What you will learn

  • Explore and apply different interactive data visualization techniques
  • Manipulate plotting parameters and styles to create appealing plots
  • Customize data visualization for different audiences
  • Design data visualizations using interactive libraries
  • Use Matplotlib, Seaborn, Altair and Bokeh for drawing appealing plots
  • Customize data visualization for different scenarios

Who this book is for

This book intends to provide a solid training ground for Python developers, data analysts and data scientists to enable them to present critical data insights in a way that best captures the user's attention and imagination. It serves as a simple step-by-step guide that demonstrates the different types and components of visualization, the principles, and techniques of effective interactivity, as well as common pitfalls to avoid when creating interactive data visualizations. Students should have an intermediate level of competency in writing Python code, as well as some familiarity with using libraries such as pandas.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weโ€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere โ€” even offline. Perfect for commutes or when youโ€™re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Interactive Data Visualization with Python by Abha Belorkar,Sharath Chandra Guntuku,Shubhangi Hora,Anshu Kumar in PDF and/or ePUB format, as well as other popular books in Computer Science & Data Visualisation. We have over one million books available in our catalogue for you to explore.

Information

1. Introduction to Visualization with Python โ€“ Basic and Customized Plotting

Learning Objectives

By the end of this chapter, you will be able to:
  • Explain the concept of data visualization
  • Analyze and describe the pandas DataFrame
  • Use the basic functionalities of the pandas DataFrame
  • Create distributional plots using matplotlib
  • Generate visually appealing plots using seaborn
In this chapter, we will explore the basics of data visualization using Python programming.

Introduction

Data visualization is the art and science of telling captivating stories with data. Today's developers and data scientists, irrespective of their operational domain, agree that communicating insights effectively using data visualization is very important.
Data scientists are always looking for better ways to communicate their findings through captivating visualizations. Depending on their domain, the type of visualization varies, and often, this means employing specific libraries and tools that will best suit the visualization needs. Thus, developers and data scientists are looking for a comprehensive resource containing quick, actionable information on this topic. The resources for learning interactive data visualization are scarce. Moreover, the available materials either deal with tools other than Python (for example, Tableau) or focus on a single Python library for visualization. This book is designed to be accessible for anyone who is well-versed in Python.
Why Python? While most languages have associated packages and libraries built specifically for visualization tasks, Python is uniquely empowered to be a convenient tool for data visualization. Python performs advanced numerical and scientific computations with libraries such as numpy and scipy, hosts a wide array of machine learning methods owing to the availability of the scikit-learn package, provides a great interface for big data manipulation due to the availability of the pandas package and its compatibility with Apache Spark, and generates aesthetically pleasing plots and figures with libraries such as seaborn, plotly, and more.
The book will demonstrate the principles and techniques of effective interactive visualization through relatable case studies and aims to enable you to become confident in creating your own context-appropriate interactive data visualizations using Python. Before diving into the different visualization types and introducing interactivity features (which, as we will see in this book, will play a very useful role in certain scenarios), it is essential to go through the basics, especially with the pandas and seaborn libraries, which are popularly used in Python for data handling and visualization.
This chapter serves as a refresher and one-stop resource for reviewing these basics. Specifically, it illustrates creating and handling pandas DataFrame, the basics of plotting with pandas and seaborn, and tools for manipulating plotting style and enhancing the visual appeal of your plots.

Note

Some of the images in this chapter have colored notations, you can find high-quality color images used in this chapter at: https://github.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/tree/master/Graphics/Lesson1.

Handling Data with pandas DataFrame

The pandas library is an extremely resourceful open source toolkit for handling, manipulating, and analyzing structured data. Data tables can be stored in the DataFrame object available in pandas, and data in multiple formats (for example, .csv, .tsv, .xlsx, and .json) can be read directly into a DataFrame. Utilizing built-in functions, DataFrames can be efficiently manipulated (for example, converting tables between different views, such as, long/wide; grouping by a specific column/feature; summarizing data; and more).

Reading Data from Files

Most small-to medium-sized datasets are usually available or shared as delimited files such as comma-separated values (CSV), tab-separated values (TSV), Excel (.xslx), and JSON files. Pandas provides built-in I/O functions to read files in several formats, such as, read_csv, read_excel, and read_json, and so on into a DataFrame. In this section, we will use the diamonds dataset (hosted in book GitHub repository).

Note

The datasets used here can be found in https://github.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/tree/master/datasets.

Exercise 1: Reading Data from Files

In this exercise, we will read from a dataset. The example here uses the diamonds dataset:
  1. Open a jupyter notebook and load the pandas and seaborn libraries:
    #Load pandas library
    import pandas as pd
    import seaborn as sns
  2. Specify the URL of the dataset:
    #URL of the dataset
    diamonds_url = "https://raw.githubusercontent.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/master/datasets/diamonds.csv"
  3. Read files from the URL into ...

Table of contents

  1. Preface
  2. 1. Introduction to Visualization with Python โ€“ Basic and Customized Plotting
  3. 2. Static Visualization โ€“ Global Patterns and Summary Statistics
  4. 3. From Static to Interactive Visualization
  5. 4. Interactive Visualization of Data across Strata
  6. 5. Interactive Visualization of Data across Time
  7. 6. Interactive Visualization of Geographical Data
  8. 7. Avoiding Common Pitfalls to Create Interactive Visualizations
  9. Appendix