问题
Rs wilcox.test can take different length vectors, but the wilcoxon from scipy.stats cannot: I get an unequal N error message.
from scipy.stats import wilcoxon
wilcoxon(range(10), range(12))
Is there a way to get Rs behavior in Python?
回答1:
According to the R docs:
Performs one- and two-sample Wilcoxon tests on vectors of data; the latter is also known as ‘Mann-Whitney’ test.
So just use
from scipy.stats import mannwhitneyu
mannwhitneyu(range(10), range(12))
# (50.0, 0.26494055917435472)
来源:https://stackoverflow.com/questions/33890367/python-wilcoxon-unequal-n