polars_plan::dsl::functions

Function cast

Source
pub fn cast(expr: Expr, dtype: DataType) -> Expr
Expand description

Casts the column given by Expr to a different type.

Follows the rules of Rust casting, with the exception that integers and floats can be cast to DataType::Date and DataType::DateTime(_, _). A column consisting entirely of Null can be cast to any type, regardless of the nominal type of the column.