From the course: Python Data Analysis (2020)
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Indexing in pandas - Python Tutorial
From the course: Python Data Analysis (2020)
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,…
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.