視覺化 airline 資料集
現在你要回顧第 1 章的內容。你會操作一個新資料集,其中包含 1949 年 1 月到 1960 年 12 月間,每月搭乘民航班機的乘客人數。
我們已為你列印出 airline DataFrame 的前 5 列和後 5 列,方便你查看。
本練習屬於課程
使用 Python 視覺化時間序列資料
練習說明
- 以「blue」折線圖繪製
airline的時間序列。 - 在圖上 1955 年 12 月 1 日的位置加上一條垂直線。
- 在圖上設定 x 軸標籤:
'Date'。 - 在圖上設定標題:
'Number of Monthly Airline Passengers'。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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()