polars_lazy::dsl

Function col

pub fn col<S>(name: S) -> Expr
where S: Into<PlSmallStr>,
Expand description

Create a Column Expression based on a column name.

§Arguments

  • name - A string slice that holds the name of the column. If a column with this name does not exist when the LazyFrame is collected, an error is returned.

§Examples

// select a column name
col("foo")
// select all columns by using a wildcard
col("*")
// select specific columns by writing a regular expression that starts with `^` and ends with `$`
// only if regex features is activated
col("^foo.*$")