Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scipy Wilcoxon throwing TypeError when trying to specify an alternative hypothesis

Tags:

python

scipy

As the title states, when I try to specify an alternative hypothesis using the 'alternative' parameter for the scipy.stats.wilcoxon()function, it throws a TypeError. The TypeError states wilcoxon() got an unexpected keyword argument 'alternative'.

I don't encounter any issues when I specify different a different zero_method and runs as expected when I remove the 'alternative' parameter.

Scipy version 1.2.1.

Any help would be greatly appreciated.

Code as simple as:

from scipy.stats import wilcoxon data = [1,2,3,4,5,6,7,8,9] print(wilcoxon(data, alternative='greater'))

will cause the TypeError to appear.

like image 584
tor_sci Avatar asked Dec 14 '25 04:12

tor_sci


1 Answers

The alternative parameter was added to scipy.stats.wilcoxon in SciPy 1.3.0.

Unfortunately, the addition is not mentioned in the 1.3.0 release notes. The change is among the pull requests for 1.3.0, though.

like image 189
Warren Weckesser Avatar answered Dec 15 '25 17:12

Warren Weckesser