polars.DataFrame.select

DataFrame.select(exprs: Union[str, polars.internals.expr.Expr, Sequence[Union[str, polars.internals.expr.Expr, bool, int, float, polars.internals.series.Series]], polars.internals.series.Series]) polars.internals.frame.DF

Select columns from this DataFrame.

Parameters
exprs

Column or columns to select.

Examples

>>> df = pl.DataFrame(
...     {
...         "foo": [1, 2, 3],
...         "bar": [6, 7, 8],
...         "ham": ["a", "b", "c"],
...     }
... )
>>> df.select("foo")
shape: (3, 1)
┌─────┐
│ foo │
│ --- │
│ i64 │
╞═════╡
│ 1   │
├╌╌╌╌╌┤
│ 2   │
├╌╌╌╌╌┤
│ 3   │
└─────┘