Function polars::prelude::cast

source ·
pub fn cast(expr: Expr, data_type: DataType) -> Expr
Available on crate feature lazy only.
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 of Null can be cast to any type, regardless of the nominal type of the column.