tabsdata.tableframe.lazyframe.frame.TableFrame.slice#

TableFrame.slice(offset: int, length: int | None = None) TableFrame[source]#

Return a TableFrame with a slice of the original TableFrame

Parameters:
  • offset – Slice starting index.

  • length – The length of the slice. None means all the way to the end.

Example:

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