tabsdata.tableframe.lazyframe.frame.TableFrame.head#

TableFrame.head(n: int = 5) TableFrame[source]#

Return a TableFrame with the first n rows.

Parameters:

n – The number of rows to return.

Example:

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ str ┆ i64 │
╞═════╪═════╡
│ A   ┆ 1   │
│ X   ┆ 10  │
│ C   ┆ 3   │
│ D   ┆ 5   │
│ M   ┆ 9   │
└─────┴─────┘
>>>
>>> tf.head(2)
>>>
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ str ┆ i64 │
╞═════╪═════╡
│ A   ┆ 1   │
│ X   ┆ 10  │
└─────┴─────┘