From the course: Python for Data Visualization

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Simplify with slicing

Simplify with slicing

- [Instructor] When working with large data sets, oftentimes you're only interested in a smaller subset of your data, and that's why slicing is so important. And in this video, I'll teach you how to select columns in pandas, because oftentimes, you're only interested in a smaller subset of columns in your data, and I'll also show you how to use slicing operations in pandas. I'm working with a car loans dataset, where I have the DataFrame df, and I'm looking at the first five rows. Let's say you're only interested in looking at a few columns of your dataset. So let's go over how to use brackets to select just a few columns. What the code here does is we're using double square brackets to only output one column of our data set. And as you see, I've only pulled out the car_type column. Now, we can also select multiple columns using double brackets. And let me show you how that's done. So right here, you notice…

Contents