視覺化平均數量指標
現在你要用熱度圖來視覺化平均數量的數值。
我們已將 pandas 套件載入為 pd,並將平均數量數值的 DataFrame 載入為 average_quantity。
請使用主控台來探索它。
本練習屬於課程
Python 的客群分群
練習說明
- 將
seaborn套件匯入為sns。 - 建立一個 8×6 英吋的圖形。
- 加上標題。
- 建立帶有註記的平均數量熱度圖,並顯示該圖表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import seaborn package as sns
import ____ as sns
# Initialize an 8 by 6 inches plot figure
plt.____(figsize=(____, ____))
# Add a title
plt.____('Average Spend by Monthly Cohorts')
# Create the heatmap
sns.____(____, annot=____, cmap='Blues')
plt.____()