Example data
Where possible, the examples in this chapter will utilize several datasets provided with the code in the download for the text. These datasets make the examples a little less academic in nature. These datasets will be read from files using the pd.read_csv() function that will load the sample data from the file into a DataFrame object.
Note
pd.read_csv() will be more extensively examined in Chapter 6, Accessing Data. For now, its function is simply to load some example DataFrame objects.
The remainder of the samples will still utilize the DataFrame objects created on demand if they demonstrate the concept being examined in a better way. Let's see the brief descriptions of these datasets.
S&P 500
The first dataset we will use is a snapshot of the S&P 500 from Yahoo! Finance. The following code shows the first three lines of the file:
In [13]: # show the first three lines of the file !head -n 3 data/sp500.csv # on Mac or Linux # !type data\sp500.csv # on Windows, but...