Pandas: why pandas.Series.std() is different from numpy.std()

后端 未结 1 1894
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 13:40

Another update: resolved (see comments and my own answer).

Update: this is what I am trying to explain.

相关标签:
1条回答
  • 2020-12-10 14:31

    I see. Pandas is using Bessel's correction by default -- that is, the standard deviation formula with N-1 instead of N in the denominator. As behzad.nouri has pointed out in the comments,

    pd.Series([7,20,22,22]).std(ddof=0)==np.std([7,20,22,22])
    
    0 讨论(0)
提交回复
热议问题