Imene KOLLI
Imene KOLLI

Reputation: 117

TypeError: mannwhitneyu() got an unexpected keyword argument 'method'

I am trying to run a Mann-Whitney test using scipy.stats.mannwhitneyu() with the method argument 'asymptotic' but I am getting a type error. type error

Though in the documentation this argument and key exist. See link: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.mannwhitneyu.html

I upgraded to the latest version but it didn't solve it. Any idea why is this happening and how can I fix it ?

Upvotes: 3

Views: 1067

Answers (1)

Kendall Ruber
Kendall Ruber

Reputation: 41

I am getting the same answer for scipy.stats wilcoxon package, although the documentation appeared to state method as a valid parameter.

But, I noticed that the documentation I was using referenced scipy 1.9.0 (https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html), which is not available on Anaconda-Navigator under Python 3.7 or Python 3.10.4.

So, although to my knowledge I thought I had the most recent version of this package installed, I did not. When I go back and look at the documentation for previous versions of this package, it looks like method was not an applicable parameter in older versions of scipy.stats. I am currently using 1.7.3 in my environments, (the most recent version that Anaconda-Navigator will let me install).

So, the limitations of Anaconda Navigator are preventing me from installing the version I actually need for this parameter (1.9.0).

In short: check your GUI limitations and your version of the mannwhitneyu package and see if method is a valid parameter for the specific version you have installed. I'll check back if I find another answer.

Upvotes: 2

Related Questions