tabsdata.tableframe.expr.expr.Expr.slice#
- Expr.slice(offset: int | Expr, length: int | Expr | None = None) Expr [source]#
Compute a slice of the TableFrame for the specified columns.
- Parameters:
offset – the offset to start the slice.
length – the length of the slice.
Example:
>>> 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 │ └─────┴─────┘