So far, we have learned how to work with and summarize the dataframe as a whole; however, we will often be interested in performing operations and/or analyses on subsets of our data. There are many types of subsets we may look to isolate from our data, such as selecting only specific columns or rows as a whole or when a specific criterion is met. In order to obtain subsets of the data, we need to be familiar with selection, slicing, indexing, and filtering with pandas.
For this section, we will work in the 5-selection.ipynb notebook. Our setup is as follows:
>>> import pandas as pd
>>> df = pd.read_csv('data/earthquakes.csv')