polars.DataFrame.select#

DataFrame.select(exprs: Union[str, Expr, Series, Sequence[str | polars.internals.expr.expr.Expr | polars.internals.series.series.Series]]) DF[source]#

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   │
└─────┘