plydata.one_table_verbs.tail

class plydata.one_table_verbs.tail(*args, **kwargs)[source]

Select the bottom n rows

Parameters
datadataframe, optional

Useful when not using the >> operator.

nint, optional

Number of rows to return. If the data is grouped, then number of rows per group. Default is 5.

Examples

>>> import pandas as pd
>>> df = pd.DataFrame({
...     'x': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
...     'y': list('aaaabbcddd') })
>>> df >> tail(2)
    x  y
8   9  d
9  10  d

Grouped dataframe

>>> df >> group_by('y') >> tail(2)
groups: ['y']
    x  y
0   3  a
1   4  a
2   5  b
3   6  b
4   7  c
5   9  d
6  10  d