Now that we can make pandas series and DataFrames, let's work with the data they contain. In this section, we will see how to get and manipulate the data we store in a pandas series or DataFrame. Naturally, this is an important topic; these objects will be useless otherwise.
You should not be surprised that there are many variations on how to subset DataFrames. We will not cover every idiosyncrasy here; refer to the documentation for an exhaustive discussion. But we will discuss the most important functionality every user of pandas should be aware of.
Let's first look at series. Since they are similar to DataFrames, there are key lessons that apply there. The simplest way to subset a series is with square brackets, and we can do so as we would subset a list or NumPy array. The colon operator does work here, but there's more that we can do. We can select elements based on the index of the series, as opposed to just the position of the elements in the...