開始使用免費開始

標準差與變異數

正如影片中提到的,標準差是變異數的平方根。你將自己驗證這點:使用 np.std() 計算標準差,並與先用 np.var() 計算變異數後再取平方根的結果相比較。

本練習屬於課程

Statistical Thinking in Python (Part 1)

檢視課程

練習說明

  • 使用 np.var() 計算 versicolor_petal_length 陣列中資料的變異數,並存入名為 variance 的變數。
  • 印出此值的平方根。
  • 使用 np.std() 印出 versicolor_petal_length 陣列中資料的標準差。

動手互動練習

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

# Compute the variance: variance


# Print the square root of the variance


# Print the standard deviation
編輯並執行程式碼