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
datasequence

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_missingbool, optional

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