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
From the course: Python for Data Visualization (2019)
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Introduction to pandas52s
-
Create sample data3m 50s
-
Load sample data2m 17s
-
Basic operations1m 57s
-
Slicing4m 12s
-
Filtering5m 39s
-
Renaming and deleting columns3m 16s
-
Aggregate functions2m 39s
-
Identifying missing data3m 41s
-
Removing or filling in missing data5m 3s
-
Convert pandas DataFrames to NumPy arrays or dictionaries1m 15s
-
Export pandas DataFrames to CSV and Excel files1m 28s
-
-
-
-