oupby.SeriesGroupBy.rolling ](pandas.core.groupby.SeriesGroupBy.rolling.html)
    * [ pandas.core.groupby.SeriesGroupBy.sample ](pandas.core.groupby.SeriesGroupBy.sample.html)
    * [ pandas.core.groupby.SeriesGroupBy.sem ](pandas.core.groupby.SeriesGroupBy.sem.html)
    * [ pandas.core.groupby.SeriesGroupBy.shift ](pandas.core.groupby.SeriesGroupBy.shift.html)
    * [ pandas.core.groupby.SeriesGroupBy.size ](pandas.core.groupby.SeriesGroupBy.size.html)
    * [ pandas.core.groupby.SeriesGroupBy.skew ](pandas.core.groupby.SeriesGroupBy.skew.html)
    * [ pandas.core.groupby.SeriesGroupBy.std ](pandas.core.groupby.SeriesGroupBy.std.html)
    * [ pandas.core.groupby.SeriesGroupBy.sum ](pandas.core.groupby.SeriesGroupBy.sum.html)
    * [ pandas.core.groupby.SeriesGroupBy.var ](pandas.core.groupby.SeriesGroupBy.var.html)
    * [ pandas.core.groupby.SeriesGroupBy.tail ](pandas.core.groupby.SeriesGroupBy.tail.html)
    * [ pandas.core.groupby.SeriesGroupBy.take ](pandas.core.groupby.SeriesGroupBy.take.html)
    * [ pandas.core.groupby.SeriesGroupBy.value_counts ](pandas.core.groupby.SeriesGroupBy.value_counts.html)
    * [ pandas.core.groupby.DataFrameGroupBy.boxplot ](pandas.core.groupby.DataFrameGroupBy.boxplot.html)
    * [ pandas.core.groupby.DataFrameGroupBy.hist ](pandas.core.groupby.DataFrameGroupBy.hist.html)
    * [ pandas.core.groupby.SeriesGroupBy.hist ](pandas.core.groupby.SeriesGroupBy.hist.html)
    * [ pandas.core.groupby.DataFrameGroupBy.plot ](pandas.core.groupby.DataFrameGroupBy.plot.html)
    * [ pandas.core.groupby.SeriesGroupBy.plot ](pandas.core.groupby.SeriesGroupBy.plot.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ GroupBy ](../groupby.html)
  * pandas.core.... 

#  pandas.core.groupby.DataFrameGroupBy.rank  #

DataFrameGroupBy.  rank  (  _ method  =  'average'  _ , _ ascending  =  True
_ , _ na_option  =  'keep'  _ , _ pct  =  False  _ , _ axis  =
_NoDefault.no_default  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/groupby/groupby.py#L4708-L4814) #

    

Provide the rank of values within each group.

Parameters  :

    

**method** {âaverageâ, âminâ, âmaxâ, âfirstâ, âdenseâ},
default âaverageâ

    

  * average: average rank of group. 

  * min: lowest rank in group. 

  * max: highest rank in group. 

  * first: ranks assigned in order they appear in the array. 

  * dense: like âminâ, but rank always increases by 1 between groups. 

**ascending** bool, default True

    

False for ranks by high (1) to low (N).

**na_option** {âkeepâ, âtopâ, âbottomâ}, default âkeepâ

    

  * keep: leave NA values where they are. 

  * top: smallest rank if ascending. 

  * bottom: smallest rank if descending. 

**pct** bool, default False

    

Compute percentage rank of data within each group.

**axis** int, default 0

    

The axis of the object over which to compute the rank.

Deprecated since version 2.1.0:  For axis=1, operate on the underlying object
instead. Otherwise the axis keyword is not necessary.

Returns  :

    

DataFrame with ranking of values within each group

    

See also

` Series.groupby  `

    

Apply a function groupby to a Series.

` DataFrame.groupby  `

    

Apply a function groupby to each row or column of a DataFrame.

Examples

    
    
    >>> df = pd.DataFrame(
    ...     {
    ...         "group": ["a", "a", "a", "a", "a", "b", "b", "b", "b", "b"],
    ...         "value": [2, 4, 2, 3, 5, 1, 2, 4, 1, 5],
    ...     }
    ... )
    >>> df
      group  value
    0     a      2
    1     a      4
    2     a      2
    3     a      3
    4     a      5
    5     b      1
    6     b      2
    7     b      4