Visualize the airline dataset
You will now review the contents of chapter 1. You will have the opportunity to work with a new dataset that contains the monthly number of passengers who took a commercial flight between January 1949 and December 1960.
We have printed the first 5 and the last 5 rows of the airline
DataFrame for you to review.
This exercise is part of the course
Visualizing Time Series Data in Python
Exercise instructions
- Plot the time series of
airline
using a "blue" line plot. - Add a vertical line on this plot at December 1, 1955.
- Specify the x-axis label on your plot:
'Date'
. - Specify the title of your plot:
'Number of Monthly Airline Passengers'
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot the time series in your DataFrame
ax = airline.____(____, fontsize=12)
# Add a red vertical line at the date 1955-12-01
____('1955-12-01', color='red', linestyle='--')
# Specify the labels in your plot
ax.____('Date', fontsize=12)
ax.____('Number of Monthly Airline Passengers', fontsize=12)
plt.show()