con_series=stroop["Congruent"]
incon_series=stroop["Incongruent"]
from scipy import stats
from scipy.stats import ttest_rel
ttestresults=stats.ttest_rel(incon_series,con_series)
tstatistic=ttestresults[0]
pvalue=ttestresults[1]
print"t-statistic="+'%.2f' %tstatistic
print"p-value="+'%.8f' %pvalue
最后几行是亮点,觉得写的太好啦~
output:
t-statistic=8.02 p-value=0.00000004