Expr.slice
methodView source ↗
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
offsetthe offset to start the slice.
parameter
lengththe length of the slice.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌──────┬──────┐
│ x ┆ y │
│ --- ┆ --- │
│ f64 ┆ f64 │
╞══════╪══════╡
│ 1.0 ┆ 2.0 │
│ 2.0 ┆ 2.0 │
│ NaN ┆ NaN │
│ 4.0 ┆ NaN │
│ 5.0 ┆ null │
│ null ┆ null │
└──────┴──────┘
>>>
>>> tf.select(tf.all().slice(1,2))
>>>
┌─────┬─────┐
│ x ┆ y │
│ --- ┆ --- │
│ f64 ┆ f64 │
╞═════╪═════╡
│ 2.0 ┆ 2.0 │
│ NaN ┆ NaN │
└─────┴─────┘