from scipy import stats np.random.seed(7654567) # fix seed to get the same result rvs = stats.norm.rvs(loc=5, scale=10, size=(50,2)) stats.ttest_1samp(rvs,5.0) # returns (t, p) stats.ttest_1samp(rvs,0.0)