Filtering rows of a pandas DataFrame

In this section, we'll learn about methods for filtering rows and columns from a pandas DataFrame, and we will introduce a couple of ways to accomplish this. We will also learn about pandas' filter method, and how to use it on our real dataset, as well as ways to protect data based on a Boolean series that we will create from our data. We'll also learn how to pass the conditions directly to the DataFrame for filtering data.

We will start by importing the pandas module and reading the dataset of house prices from into the Jupyter Notebook. First, we explore pandas' filter method for filtering data. We can filter columns using the filter method. To do this, we need to pass columns as a list to ...

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.