Exercises
Using the CSV files in the exercises/
folder and what we have learned so far in this book, complete the following exercises:
- With the
earthquakes.csv
file, select all the earthquakes in Japan with a magnitude of 4.9 or greater using themb
magnitude type. - Create bins for each full number of earthquake magnitude (for instance, the first bin is (0, 1], the second is (1, 2], and so on) with the
ml
magnitude type and count how many are in each bin. - Using the
faang.csv
file, group by the ticker and resample to monthly frequency. Make the following aggregations:a) Mean of the opening price
b) Maximum of the high price
c) Minimum of the low price
d) Mean of the closing price
e) Sum of the volume traded
- Build a crosstab with the earthquake data between the
tsunami
column and themagType
column. Rather than showing the frequency count, show the maximum magnitude that was observed for each combination. Put the magnitude type along the columns. - Calculate the rolling...