Question about Mann Whitney U and Rank Sum test in Scipy I am trying to compare the average visual acuity between to sets of independent groups using logMAR visual acuity.
As the sample size is small I have opted for the Mann-Whitney U test which, in my understanding, is the same as the Wilcoxon Rank Sum test.
I am using scipy in python and my code is as follows;
import scipy.stats as stats

mPVR = [0.00, -0.18, -0.08, 0.30, 0.48, 0.60]
iERM = [1.00, 0.60, 0.78, 0.10, 0.00, 0.18, 0.60, 0.48, -0.18, -0.08]

MWU = stats.mannwhitneyu(mPVR, iERM, use_continuity=True, alternative="two-sided")

WRS = stats.ranksums(mPVR, iERM, alternative="two-sided")

print(MWU)
print(" ")
print(WRS)
____________________________________________________________________________________________

MannwhitneyuResult(statistic=22.0, pvalue=0.4131761509873124)
 
RanksumsResult(statistic=-0.8677218312746247, pvalue=0.385546631571102)

Now I am asking these questions for my learning.
1) Why are the p-values produced by the Mann-Whitney U and Rank Sums test different if the two tests are the same?
2) If they are indeed not the same (which I very much suspect given that there are two different functions) then which test would be most appropriate to use in this scenario?
3) If the tests should produce the same p-value, then what have I done wrong with the above?

The documentation page of scipy.stats.ranksums reads

This test should be used to compare two samples from continuous
distributions. It does not handle ties between measurements in x and
y. For tie-handling and an optional continuity correction see
scipy.stats.mannwhitneyu.

Indeed, by setting use_continuity=True and removing one instance of 0.60 from iERM, you will see that the two tests give identical results.
It goes without saying that in this case, you should definitely use Mann-Whitney.
