Exercises
Complete the following exercises using what we have learned so far in this book and the data in the exercises/
directory:
- We want to look at data for the Facebook, Apple, Amazon, Netflix, and Google (FAANG) stocks, but we were given each as a separate CSV file (obtained using the
stock_analysis
package we will build in Chapter 7, Financial Analysis – Bitcoin and the Stock Market). Combine them into a single file and store the dataframe of the FAANG data asfaang
for the rest of the exercises:a) Read in the
aapl.csv
,amzn.csv
,fb.csv
,goog.csv
, andnflx.csv
files.b) Add a column to each dataframe, called
ticker
, indicating the ticker symbol it is for (Apple's is AAPL, for example); this is how you look up a stock. In this case, the filenames happen to be the ticker symbols.c) Append them together into a single dataframe.
d) Save the result in a CSV file called
faang.csv
. - With
faang
, use type conversion to cast the values of thedate
column into datetimes...