pandas.DataFrame.rank



DataFrame.rank(axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False)

Function: Calculate the numerical data (1 to n) along the axis. The rank of equivalents is the average of the ranks of those values. Returns the index sorted from smallest to largest.

Parameters: axis : {0 or 'index', 1 or 'columns'}, default value 0 Sort by which axis

      method : {'average', 'min', 'max', 'first'} default value average

      average : In equal grouping, assign the average rank to each value

      min: use the minimum rank of the entire grouping

      max: use the maximum rank of the entire grouping

      first: assign the rank according to the order in which the values ​​appear in the original data http://www.cppentry.com Programming Getting Started for Developers p>

    numeric_only : boolean, the default value of None contains only float, int and boolean data. Valid only for DataFrame or Panel objects

    na_option: {'keep', 'top', 'bottom'}  

      keep: keep NA values ​​in their original position

      top: if ascending, put NA values ​​first

      bottom: if descending, put NA Value ranks first

      Ascending : boolean, the default value True

      True is the ascending order rank False is the descending order rank

       pct : boolean, the default value False

       calculates the percentage rank of the data

Return : ranks : same as the caller type

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326396917&siteId=291194637