为什么R和Python Mann Whitney不同?

use*_*890 3 python statistics r

我想知道为什么我的答案在python和R中进行mann whitney u测试时是如此不同.在python中:

from scipy.stats import mannwhitneyu
t = [1,2,3]
g = [4,5,6,7,8,9]
mannwhitneyu(t,g)
(0.0, 0.014092901073953692)
Run Code Online (Sandbox Code Playgroud)

在R:

t = c(1,2,3)
g = c(4,5,6,7,8,9)
wilcox.test(t,g, paired = FALSE)

   Wilcoxon rank sum test

data:  t and g
W = 0, p-value = 0.02381
alternative hypothesis: true location shift is not equal to 0
Run Code Online (Sandbox Code Playgroud)

我想知道为什么python看起来更像是单面测试.

Bre*_*arn 6

记录scipy版本以返回单侧p值.(目前,doc网站对我不起,所以我无法提供链接,但如果查看该mannwhitneyu功能的帮助,就可以看到它.)R函数记录在案,允许您指定侧面度,双面作为默认值.