Inspecting a DataFrame object
The first thing we should do when we read in our data is inspect it; we want to make sure that our dataframe isn't empty and that the rows look as we would expect. Our main goal is to verify that it was read in properly and that all the data is there; however, this initial inspection will also give us ideas with regard to where we should direct our data wrangling efforts. In this section, we will explore ways in which we can inspect our dataframes in the 4-inspecting_dataframes.ipynb
notebook.
Since this is a new notebook, we must once again handle our setup. This time, we need to import pandas
and numpy
, as well as read in the CSV file with the earthquake data:
>>> import numpy as np >>> import pandas as pd >>> df = pd.read_csv('data/earthquakes.csv')
Examining the data
First, we want to make sure that we actually have data in our dataframe. We can check the empty
attribute to find out:
>>...