Book Image

Interactive Data Visualization with Python - Second Edition

By : Abha Belorkar, Sharath Chandra Guntuku, Shubhangi Hora, Anshu Kumar
Book Image

Interactive Data Visualization with Python - Second Edition

By: Abha Belorkar, Sharath Chandra Guntuku, Shubhangi Hora, Anshu Kumar

Overview of this book

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.
Table of Contents (9 chapters)

Choosing the Right Aggregation Level for Temporal Data

We will now introduce how time is handled and how to extract time components from a datetime object. Choosing the right aggregation level can be tricky and is worth exploring. A natural time aggregation, such as day or hour, may not be representative of the pattern. For example, an e-commerce website might have cyclical patterns on active users based on morning, afternoon, and evening. The aggregation level might not be present in the data and will need to be feature engineered in order to create new features. This is a common practice in the Machine Learning(ML) domain.

Now, let's do some hands-on exercises pertaining to date handling. We will use the AirPassengerDates.csv dataset.

Example 1: Converting Date Columns to pandas DateTime Objects

We'll start by importing the necessary Python modules and read from the AirpassengersDates.csv dataset using the following code:

#Import pandas library and read DataFrame...