O'Reilly logo

Automate it! - Recipes to upskill your business by Chetan Giridhar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating insights using data filtering and aggregation

Reading CSV files and selecting multiple columns is easy with pandas. In this section, we will take a look at how to slice and dice data, essentially filtering data with pandas.

Getting ready

In this section, we will use the same set of libraries (the following ones) that we used in the previous recipe:

  • pandas for filtering and data analysis
  • matplotlib and seaborn for plotting charts and saving the data in a PDF file

How to do it...

  1. Let's start by importing the required libraries and reading the CSV file with the read_csv() method. The following code carries out the operations:
     import pandas as pd from matplotlib import pyplot as plt import seaborn as sns plt.style.use('default') pd.set_option('display.line_width', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required