@@ -1776,7 +1776,29 @@ def cumcount(self, ascending=True):
17761776 @Appender (_doc_template )
17771777 def rank (self , method = 'average' , ascending = True , na_option = 'keep' ,
17781778 pct = False , axis = 0 ):
1779- """Rank within each group"""
1779+ """Provides the rank of values within each group
1780+
1781+ Parameters
1782+ ----------
1783+ method : {'average', 'min', 'max', 'first', 'dense'}, efault 'average'
1784+ * average: average rank of group
1785+ * min: lowest rank in group
1786+ * max: highest rank in group
1787+ * first: ranks assigned in order they appear in the array
1788+ * dense: like 'min', but rank always increases by 1 between groups
1789+ method : {'keep', 'top', 'bottom'}, default 'keep'
1790+ * keep: leave NA values where they are
1791+ * top: smallest rank if ascending
1792+ * bottom: smallest rank if descending
1793+ ascending : boolean, default True
1794+ False for ranks by high (1) to low (N)
1795+ pct : boolean, default False
1796+ Compute percentage rank of data within each group
1797+
1798+ Returns
1799+ -----
1800+ DataFrame with ranking of values within each group
1801+ """
17801802 return self ._cython_transform ('rank' , numeric_only = False ,
17811803 ties_method = method , ascending = ascending ,
17821804 na_option = na_option , pct = pct , axis = axis )
@@ -2198,11 +2220,12 @@ def get_group_levels(self):
21982220 'cummax' : 'group_cummax' ,
21992221 'rank' : {
22002222 'name' : 'group_rank' ,
2201- 'f' : lambda func , a , b , c , d , ** kwargs : func (a , b , c , d ,
2202- kwargs .get ('ties_method' , 'average' ),
2203- kwargs .get ('ascending' , True ),
2204- kwargs .get ('pct' , False ),
2205- kwargs .get ('na_option' , 'keep' )
2223+ 'f' : lambda func , a , b , c , d , ** kwargs : func (
2224+ a , b , c , d ,
2225+ kwargs .get ('ties_method' , 'average' ),
2226+ kwargs .get ('ascending' , True ),
2227+ kwargs .get ('pct' , False ),
2228+ kwargs .get ('na_option' , 'keep' )
22062229 )
22072230 }
22082231 }
0 commit comments