Skip to main content
Version: 1.9.1

TableFrame.slice

def slice(offset: int, length: int | None = None) -> TableFrame

Categories: filters

Return a TableFrame with a slice of the original TableFrame

Parameters

parameter
offset

Slice starting index.

parameter
length

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

Examples

>>> 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
└─────┴─────┘