From the course: Python for Data Visualization (2019)

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Filtering

Filtering

- [Instructor] When working with a data set, often times you're only interested in a smaller subset to your data. For example, say I have a car loan data set, and I want to filter out the data to only have a car type of Toyota Sienna with an interest rate of 7.02 percent. So, the first thing I'm going to do is I'm going to look at the first five rows of my data set. And while it appears that the first five rows are only Toyota Siennas, that doesn't mean the rest of my data set is all of car type Toyota Sienna. The first thing I'm going to do is I'll use the value counts method on the car type column to see what other kind of cars I have in my data set. I have my data frame, I have square brackets, I have the column I'm interested in. I'm going to close those brackets, and then I have the value counts method. When I press shift enter, you'll see that I have 120 Toyota Siennas. Say for example I was interested in Toyota Corollas instead, I would have to fix the…

Contents