📅  最后修改于: 2022-03-11 14:58:30.332000             🧑  作者: Mango
from scipy import stats
X = stats.binom(10, 0.2) # Declare X to be a binomial random variable
print X.pmf(3) # P(X = 3)
print X.cdf(4) # P(X <= 4)
print X.mean() # E[X]
print X.var() # Var(X)
print X.std() # Std(X)
print X.rvs() # Get a random sample from X
print X.rvs(10) # Get 10 random samples form X