📅  最后修改于: 2022-03-11 14:46:37.939000             🧑  作者: Mango
import numpy as np
import scipy.stats as st
#define sample data
data = [12, 12, 13, 13, 15, 16, 17, 22, 23, 25, 26, 27, 28, 28, 29]
#create 95% confidence interval for population mean weight
st.t.interval(alpha=0.95, df=len(data)-1, loc=np.mean(data), scale=st.sem(data))
(16.758, 24.042)