You are viewing documentation about an older version (1.21.0). View latest version

modin.pandas.DataFrame.rank¶

DataFrame.rank(axis=0, method: str = 'average', numeric_only: bool = False, na_option: str = 'keep', ascending: bool = True, pct: bool = False)[source]¶

Compute numerical data ranks (1 through n) along axis.

Parameters:
  • axis ({0 or 'index', 1 or 'columns'}, default 0) – Index to direct ranking. For Series this parameter is unused and defaults to 0.

  • method ({'average', 'min', 'max', 'first', 'dense'}, default 'average') – How to rank the group of records that have the same value (i.e. break ties): - average: average rank of the group - min: lowest rank in the group - max: highest rank in the group - first: ranks assigned in order they appear in the array - dense: like ‘min’, but rank always increases by 1 between groups.

  • numeric_only (bool, default False) – For DataFrame objects, rank only numeric columns if set to True.

  • na_option ({'keep', 'top', 'bottom'}, default 'keep') – How to rank NaN values: - keep: assign NaN rank to NaN values - top: assign lowest rank to NaN values - bottom: assign highest rank to NaN values

  • ascending (bool, default True) – Whether or not the elements should be ranked in ascending order.

  • pct (bool, default False) – Whether or not to display the returned rankings in percentile form.

Return type:

Series or DataFrame with data ranks as values.