259259 "dense_rank" ,
260260 "percent_rank" ,
261261 "cume_dist" ,
262+ "ntile" ,
262263]
263264
264265
@@ -1816,18 +1817,16 @@ def rank() -> Expr:
18161817 is an example of a dataframe with a window ordered by descending ``points`` and the
18171818 associated rank.
18181819
1819- You should set ``order_by`` to produce meaningful results.
1820+ You should set ``order_by`` to produce meaningful results::
18201821
1821- ```
1822- +--------+------+
1823- | points | rank |
1824- +--------+------+
1825- | 100 | 1 |
1826- | 100 | 1 |
1827- | 50 | 3 |
1828- | 25 | 4 |
1829- +--------+------+
1830- ```
1822+ +--------+------+
1823+ | points | rank |
1824+ +--------+------+
1825+ | 100 | 1 |
1826+ | 100 | 1 |
1827+ | 50 | 3 |
1828+ | 25 | 4 |
1829+ +--------+------+
18311830
18321831 To set window function parameters use the window builder approach described in the
18331832 ref:`_window_functions` online documentation.
@@ -1840,18 +1839,16 @@ def dense_rank() -> Expr:
18401839
18411840 This window function is similar to :py:func:`rank` except that the returned values
18421841 will be consecutive. Here is an example of a dataframe with a window ordered by
1843- descending ``points`` and the associated dense rank.
1842+ descending ``points`` and the associated dense rank::
18441843
1845- ```
1846- +--------+------------+
1847- | points | dense_rank |
1848- +--------+------------+
1849- | 100 | 1 |
1850- | 100 | 1 |
1851- | 50 | 2 |
1852- | 25 | 3 |
1853- +--------+------------+
1854- ```
1844+ +--------+------------+
1845+ | points | dense_rank |
1846+ +--------+------------+
1847+ | 100 | 1 |
1848+ | 100 | 1 |
1849+ | 50 | 2 |
1850+ | 25 | 3 |
1851+ +--------+------------+
18551852
18561853 To set window function parameters use the window builder approach described in the
18571854 ref:`_window_functions` online documentation.
@@ -1865,18 +1862,16 @@ def percent_rank() -> Expr:
18651862 This window function is similar to :py:func:`rank` except that the returned values
18661863 are the percentage from 0.0 to 1.0 from first to last. Here is an example of a
18671864 dataframe with a window ordered by descending ``points`` and the associated percent
1868- rank.
1865+ rank::
18691866
1870- ```
1871- +--------+--------------+
1872- | points | percent_rank |
1873- +--------+--------------+
1874- | 100 | 0.0 |
1875- | 100 | 0.0 |
1876- | 50 | 0.666667 |
1877- | 25 | 1.0 |
1878- +--------+--------------+
1879- ```
1867+ +--------+--------------+
1868+ | points | percent_rank |
1869+ +--------+--------------+
1870+ | 100 | 0.0 |
1871+ | 100 | 0.0 |
1872+ | 50 | 0.666667 |
1873+ | 25 | 1.0 |
1874+ +--------+--------------+
18801875
18811876 To set window function parameters use the window builder approach described in the
18821877 ref:`_window_functions` online documentation.
@@ -1890,18 +1885,16 @@ def cume_dist() -> Expr:
18901885 This window function is similar to :py:func:`rank` except that the returned values
18911886 are the ratio of the row number to the total numebr of rows. Here is an example of a
18921887 dataframe with a window ordered by descending ``points`` and the associated
1893- cumulative distribution.
1888+ cumulative distribution::
18941889
1895- ```
1896- +--------+-----------+
1897- | points | cume_dist |
1898- +--------+-----------+
1899- | 100 | 0.5 |
1900- | 100 | 0.5 |
1901- | 50 | 0.75 |
1902- | 25 | 1.0 |
1903- +--------+-----------+
1904- ```
1890+ +--------+-----------+
1891+ | points | cume_dist |
1892+ +--------+-----------+
1893+ | 100 | 0.5 |
1894+ | 100 | 0.5 |
1895+ | 50 | 0.75 |
1896+ | 25 | 1.0 |
1897+ +--------+-----------+
19051898
19061899 To set window function parameters use the window builder approach described in the
19071900 ref:`_window_functions` online documentation.
@@ -1915,23 +1908,20 @@ def ntile(groups: int) -> Expr:
19151908 This window function orders the window frame into a give number of groups based on
19161909 the ordering criteria. It then returns which group the current row is assigned to.
19171910 Here is an example of a dataframe with a window ordered by descending ``points``
1918- and the associated n-tile function.
1919-
1920- ```
1921- +--------+-------+
1922- | points | ntile |
1923- +--------+-------+
1924- | 120 | 1 |
1925- | 100 | 1 |
1926- | 80 | 2 |
1927- | 60 | 2 |
1928- | 40 | 3 |
1929- | 20 | 3 |
1930- +--------+-------+
1931- ```
1911+ and the associated n-tile function::
1912+
1913+ +--------+-------+
1914+ | points | ntile |
1915+ +--------+-------+
1916+ | 120 | 1 |
1917+ | 100 | 1 |
1918+ | 80 | 2 |
1919+ | 60 | 2 |
1920+ | 40 | 3 |
1921+ | 20 | 3 |
1922+ +--------+-------+
19321923
19331924 To set window function parameters use the window builder approach described in the
19341925 ref:`_window_functions` online documentation.
19351926 """
1936- # Developer note: ntile only accepts literal values.
19371927 return Expr (f .ntile (Expr .literal (groups ).expr ))
0 commit comments