From the course: Python Data Analysis

Unlock the full course today

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

Indexing in pandas

Indexing in pandas - Python Tutorial

From the course: Python Data Analysis

Start my 1-month free trial

Indexing in pandas

- [Instructor] We have seen how to load and create dataframes and how to select records based on boolean conditions both with fancy indexing and with a string expression-based query interface. Now we'll see how we can make selections even more directly and more efficiently using indices. So let's load up our Nobel list data set again. The index is currently the simplest possible just numbers from zero through 949. We elevate the years to serve as index. We do this with a set index method which does not work in place but other creates a new dataframe. Now the years appear as the index at the front of each row. And here's the index itself. This shows that in Pandas, indices do not need to have unique values. That's a feature, not a bug. It lets us select all records for a year, for instance, using the indexing notation and here things get a bit complicated. There are several ways to do indexing and slicing in Pandas,…

Contents