1==== 2Rank 3==== 4 5There are many ways to rank a sequence of values. agate strives to find a balance between simple, intuitive ranking and flexibility when you need it. 6 7Competition rank 8================ 9 10The basic rank supported by agate is standard "competition ranking". In this model the values :code:`[3, 4, 4, 5]` would be ranked :code:`[1, 2, 2, 4]`. You can apply competition ranking using the :class:`.Rank` computation: 11 12.. code-block:: python 13 14 new_table = table.compute([ 15 ('rank', agate.Rank('value')) 16 ]) 17 18Rank descending 19=============== 20 21Descending competition ranking is specified using the :code:`reverse` argument. 22 23.. code-block:: python 24 25 new_table = table.compute([ 26 ('rank', agate.Rank('value', reverse=True)) 27 ]) 28 29Rank change 30=========== 31 32You can compute the change from one rank to another by combining the :class:`.Rank` and :class:`.Change` computations: 33 34.. code-block:: python 35 36 new_table = table.compute([ 37 ('rank2014', agate.Rank('value2014')), 38 ('rank2015', agate.Rank('value2015')) 39 ]) 40 41 new_table2 = new_table.compute([ 42 ('rank_change', agate.Change('rank2014', 'rank2015')) 43 ]) 44 45Percentile rank 46=============== 47 48"Percentile rank" is a bit of a misnomer. Really, this is the percentile in which each value in a column is located. This column can be computed for your data using the :class:`.PercentileRank` computation: 49 50.. code-block:: Python 51 52 new_table = table.compute([ 53 ('percentile_rank', agate.PercentileRank('value')) 54 ]) 55 56Note that there is no entirely standard method for computing percentiles. The percentiles computed in this manner may not agree precisely with those generated by other software. See the :class:`.Percentiles` class documentation for implementation details. 57