Skip to main content
Version: 1.9.1

Expr.slice

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

Categories: filters

Compute a slice of the TableFrame for the specified columns.

Parameters

parameter
offset

the offset to start the slice.

parameter
length

the length of the slice.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌──────┬──────┐
│ x ┆ y │
------
│ f64 ┆ f64 │
╞══════╪══════╡
1.02.0
2.02.0
│ NaN ┆ NaN │
4.0 ┆ NaN │
5.0 ┆ null │
│ null ┆ null │
└──────┴──────┘
>>>
>>> tf.select(tf.all().slice(1,2))
>>>
┌─────┬─────┐
│ x ┆ y │
------
│ f64 ┆ f64 │
╞═════╪═════╡
2.02.0
│ NaN ┆ NaN │
└─────┴─────┘