開始使用免費開始

修改直方圖

來看看在直方圖中調整關鍵字參數會如何影響輸出。回顧一下:

  • range 用來設定要納入直方圖的資料點最小值與最大值。
  • bins 用來設定直方圖的長條數量。

我們將使用 DataFrame puppies 中各種小狗的體重。matplotlib 已以別名 plt 載入。

本練習屬於課程

Python 的資料科學入門

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create a histogram of the column weight from the DataFrame puppies
____(____.____)

# Add labels
plt.xlabel('Puppy Weight (lbs)')
plt.ylabel('Number of Puppies')

# Display
plt.show()
編輯並執行程式碼