Skip to main content
Version: 0.9.3

TableFrame.select

def select(*exprs: IntoExpr | Iterable[IntoExpr], **named_exprs: IntoExpr) -> TableFrame

Categories: projection

Select column(s) from the TableFrame.

Parameters

parameter
exprs

Columns or expressions to select.

parameter
named_exprs

Named expressions to select.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌─────┬─────┐
│ a ┆ b │
------
str ┆ i64 │
╞═════╪═════╡
│ A ┆ 1
│ X ┆ 10
│ C ┆ 3
│ D ┆ 5
│ M ┆ 9
│ A ┆ 100
│ M ┆ 50
└─────┴─────┘
>>>
>>> tf.select(td.col("a"), td.col("b").mul(2).alias("bx2"),)
>>>
┌─────┬─────┐
│ a ┆ bx2 │
------
str ┆ i64 │
╞═════╪═════╡
│ A ┆ 2
│ X ┆ 20
│ C ┆ 6
│ D ┆ 10
│ M ┆ 18
│ A ┆ 200
│ M ┆ 100
└─────┴─────┘