SciPy

This is documentation for an old release of SciPy (version 0.15.1). Read this page in the documentation of the latest stable release (version 1.14.1).

scipy.stats.mstats.rankdata

scipy.stats.mstats.rankdata(data, axis=None, use_missing=False)[source]

Returns the rank (also known as order statistics) of each data point along the given axis.

If some values are tied, their rank is averaged. If some values are masked, their rank is set to 0 if use_missing is False, or set to the average rank of the unmasked values if use_missing is True.

Parameters:

data : sequence

Input data. The data is transformed to a masked array

axis : {None,int}, optional

Axis along which to perform the ranking. If None, the array is first flattened. An exception is raised if the axis is specified for arrays with a dimension larger than 2

use_missing : {boolean}, optional

Whether the masked values have a rank of 0 (False) or equal to the average rank of the unmasked values (True).