TableFrame.slice
methodView source ↗
def slice(offset: int, length: int | None = None) -> TableFrame
Categories: filters
Return a TableFrame with a slice of the original TableFrame
Parameters
parameter
offsetSlice starting index.
parameter
lengthThe 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 │
└─────┴─────┘