Welcome to the first step in our course. This lesson demonstrates how to load and explore the Airline dataset using Python, showcasing its basic structure and notable features.
Understanding the dataset you're working with is the first key step in any data science project. Exploring the dataset helps detect trends, outliers, incorrect data, and much more. As a data scientist, it is essential to understand which questions your data can answer and which it cannot. Let's dive in and explore!
Our dataset, called the "Flights" dataset, belongs to the Seaborn library. This dataset provides a monthly tally of airline passengers from 1949 to 1960.
The Flights dataset comprises three distinct columns:
year: Represents the year in which the count of passengers was taken.month: Points towards the month in which the passenger count was gathered.passengers: Indicates the number of passengers that traveled in that month of a particular year.
Let's load the dataset in Python. You can easily load this dataset, along with other inbuilt Seaborn datasets, using the load_dataset() method as follows:
Running the above script will load the "Flights" dataset into a pandas DataFrame and display the first five records, the first ten, and the last 5 records, respectively. As you will see from the output, the dataset contains rows representing individual months over several years, with columns specifying the year, month, and number of passengers.
Now, let's delve a little deeper into the structure of our data. Our DataFrame flights_df has a specific shape, i.e., it contains a certain number of rows and columns. You can retrieve this shape using the shape attribute. This attribute returns a tuple representing the dimensionality of the DataFrame. It is used to get the current shape of DataFrame, i.e., (number of rows and columns).
Additionally, you can use the info() method to get a quick description of the data, including the total number of non-null entries and the column data types.
This will print out the number of entries, columns, column names, their data types, and the count of non-null entries per column, telling us whether our data has any missing entries. In this case, our dataset is complete and contains no missing values.
