tamtam
tamtam

Reputation: 701

python - strange behavior of scipy.stats.rankdata

Is there an explanation of the following output?

In [1]: import scipy.stats as ss
In [2]: ss.rankdata([1, 2, 3, 3, 4, 3, 4, 5])
Out [2]: array([1. , 2. , 4. , 4. , 6.5, 4. , 6.5, 8. ])

I was expected the following output, without decimals for the rankings.

Out [2]: array([1. , 2. , 4. , 4. , 6., 4. , 6., 8. ])

Also, why are the rankings of type float instead of type int?

Upvotes: 0

Views: 472

Answers (1)

Sheldore
Sheldore

Reputation: 39072

As per the SciPy webpage here, the default method is 'average' which returns the average of the ranks. Try other options of method.

Upvotes: 1

Related Questions