tabsdata.tableframe.lazyframe.frame.TableFrame.first_row#

TableFrame.first_row(named: bool = False) tuple[Any, ...] | dict[str, Any] | None[source]#

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

Example:

>>> 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'}