Skip to main content
Version: 1.9.1

TableFrame.first_row

def first_row(named: bool = False) -> tuple[Any, ...] | dict[str, Any] | None

Categories: filters

Return a tuple or dictionary with the first row, or None if no row.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌─────┬─────┐
│ A ┆ B │
------
str ┆ i64 │
╞═════╪═════╡
│ a ┆ 1
│ b ┆ 2
│ c ┆ 3
└─────┴─────┘
>>>
>>> tf.last_row()
>>>
('a', 1)
>>>
>>> tf.last_row(named=True)
>>>
{'A': 'a', 'B': '1'}