From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Select data subsets from pandas objects

Select data subsets from pandas objects - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Select data subsets from pandas objects

- [Narrator] When working with Pandas Objects, you'll find yourself needing to access or select specific parts of the data held in those Pandas Objects. There are a lot of different ways to do this. I'll be showing you the methods that are unique to Pandas Objects. Let's say that I have a variable named grades containing a Panda's data frame. And the data frame consists of students scores across five exams. I've displayed the first few rows of grades here. One way to select data from Pandas Objects is to select by label, which involves calling the lock method. For example, say I want to select a subset of the grades data frame consisting of the exam and grade columns from the grades data frame. I'll use the lock method like this. The colon indicates that I want all the rows and the list containing exam and grade indicates that I want just the exam column and the grade column. Note that a new Pandas data frame will be…

Contents