From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

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

The series index and custom indices

The series index and custom indices

- [Instructor] All right, so let's take a look at the index of a Series. The index attribute is one of the key distinguishing factors between a NumPy array and a Pandas Series. The index allows us to easily access, quote unquote, "rows" in a Pandas Series. And the same applies to DataFrames. And when we look at DataFrames, we'll also be able to access our columns using indexing. But you might be asking, "Python lists have these indexes, NumPy arrays have these indexes, why are they so special in Pandas Series?" Well, we'll answer that question in a bit, but let's just get a little bit more understanding of how to work with these indices. By default, when we create a Series, here we're creating a Series out of our sales list of integers. This is going to be that zero-index, monotonically increasing range of integers. Usually I prefer this. I often never deviate away from this integer index. It allows for easy indexing. If I wanted to grab the third element of my sales_series, I could…

Contents