I tried to calculate Spearman's rank coefficient by hand.
Data:
But when I use python, it returns a different value.
rawdata = pd.DataFrame(
[
[3,4],
[5,4],
[6,2],
[6,4],
[8,9],
[11,7]
],
columns=['Set of A','Set of B'])
print(rawdata)
correlation, pval = spearmanr(rawdata)
print(f'correlation={correlation:.6f}, p-value={pval:.6f}')
It returns:
correlation=0.585239, p-value=0.222365
What am I doing wrong here?