首页 > 解决方案 > TypeError: ttest_1samp() 得到了一个意外的关键字参数“alternative”

问题描述

我不断收到此错误消息:

TypeError: ttest_1samp() got an unexpected keyword argument 'alternative'

我的代码是:

test_stat, p_value = ttest_1samp(FF['Time'], popmean=40, alternative='greater')
print('the p-value is', p_value)

标签: pythonscipy

解决方案


更新 scipy 版本应该有帮助:

pip install --upgrade scipy

推荐阅读