@@ -598,35 +598,28 @@ def mode(values):
598
598
def rank (values , axis = 0 , method = 'average' , na_option = 'keep' ,
599
599
ascending = True , pct = False ):
600
600
"""
601
- Compute numerical data ranks (1 through n) along axis. Equal values are
602
- assigned a rank that is the average of the ranks of those values
601
+ Rank the values along a given axis.
603
602
604
603
Parameters
605
604
----------
606
- axis : {0 or 'index', 1 or 'columns'}, default 0
607
- index to direct ranking
608
- method : {'average', 'min', 'max', 'first', 'dense'}
609
- * average: average rank of group
610
- * min: lowest rank in group
611
- * max: highest rank in group
612
- * first: ranks assigned in order they appear in the array
613
- * dense: like 'min', but rank always increases by 1 between groups
614
- numeric_only : boolean, default None
615
- Include only float, int, boolean data. Valid only for DataFrame or
616
- Panel objects
617
- na_option : {'keep', 'top', 'bottom'}
618
- * keep: leave NA values where they are
619
- * top: smallest rank if ascending
620
- * bottom: smallest rank if descending
605
+ values : array-like
606
+ Array whose values will be ranked. The number of dimensions in this
607
+ array must not exceed 2.
608
+ axis : int, default 0
609
+ Axis over which to perform rankings.
610
+ method : {'average', 'min', 'max', 'first', 'dense'}, default 'average'
611
+ The method by which tiebreaks are broken during the ranking.
612
+ na_option : {'keep', 'top'}, default 'keep'
613
+ The method by which NaNs are placed in the ranking.
614
+ - ``keep``: rank each NaN value with a NaN ranking
615
+ - ``top``: replace each NaN with either +/- inf so that they
616
+ there are ranked at the top
621
617
ascending : boolean, default True
622
- False for ranks by high (1) to low (N)
618
+ Whether or not the elements should be ranked in ascending order.
623
619
pct : boolean, default False
624
- Computes percentage rank of data
625
-
626
- Returns
627
- -------
628
- ranks : same type as caller
629
- """
620
+ Whether or not to the display the returned rankings in integer form
621
+ (e.g. 1, 2, 3) or in percentile form (e.g. 0.333..., 0.666..., 1).
622
+ """
630
623
if is_categorical (values ):
631
624
ranks = values ._rank (axis = axis , method = method , ascending = ascending ,
632
625
na_option = na_option , pct = pct )
0 commit comments