P/E 比率的長條圖
為了視覺化並理解 IT 產業中 P/E 比率的分布,你可以使用長條圖(直方圖)。
上一個練習產生的陣列 it_pe 已經在你的工作區中可用。
本練習屬於課程
Python 金融入門
練習說明
- 有選擇性地將
matplotlib的pyplot模組以plt匿名匯入。 - 以 8 個 bins 繪製
it_pe的長條圖(直方圖)。 - 將 x 標籤設為
'P/E ratio',y 標籤設為'Frequency'。 - 顯示圖表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import matplotlib.pyplot with the alias plt
____
# Plot histogram
plt.____(____)
# Add x-label
plt.____('P/E ratio')
# Add y-label
plt.____('Frequency')
# Show plot
____