norm.pdf()的np.mean()和np.std()

为什么下面的代码中的np.mean和np.std()不等于0和1?

import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import norm
X=np.linspace(-2,2,10)
Y=norm.pdf(X,0,1)
print(np.mean(Y))
print(np.std(Y))

输出:

0.21936441852687888
0.1235380616222831
评论
  • 陌上桑
    陌上桑 回复

    Because Y represents the PDF of a Gaussian with mean 0 and standard deviation 1, evaluated at points in X, which cannot be negative by definition. I think you are confused on what's the difference between a distribution values and its density function.