python - Is there an easy way to get probability density of normal distribution with the help of numpy? -
i know, can use own function this:
def gauss(x, mu, sigma): return (2*pi)**(-0.5) * sigma**(-1) * math.exp( - 0.5 * ((x - mu) / sigma)**2)
probably, knows standard numpy or scipy function exists same?
thanks!
you can use scipy
:
from scipy.stats import norm x = np.arange(20) mu = 5 sigma = 3 mypdf = norm.pdf(x=x, loc=mu, scale=sigma)
Comments
Post a Comment