列印 Pandas 數列的標準偏差


在這個程式中,我們將找出 Pandas 數列的標準偏差。標準偏差是度量資料相對於其平均值的分散程度的一種統計量,計算公式為方差的平方根。

演算法

Step 1: Define a Pandas series
Step 2: Calculate the standard deviation of the series using the std() function in the pandas library.
Step 3: Print the standard deviation.

示例程式碼

import pandas as pd

series = pd.Series([10,20,30,40,50])
print("Series: \n", series)

series_std = series.std()
print("Standard Deviation of the series: ",series.std())

輸出

Series:
0    10
1    20
2    30
3    40
4    50
dtype: int64
Standard Deviation of the series:  15.811388300841896

更新於: 16-3-2021

324 次瀏覽

開啟你的 事業

完成課程並獲得認證

開始
廣告
© . All rights reserved.