2

i am trying to execute this line in my rust programme:

let filtered_df = df.filter(col("time").eq(cursor_date_str)).head(Some(1));

and the compiler returns that

error[E0425]: cannot find function `col` in this scope
  --> src/main.rs:50:37
   |
50 |         let filtered_df = df.filter(col("time").eq(cursor_date_str)).head(Some(1));
   |                                     ^^^ not found in this scope

even though i have imported all from prelude:

use polars::prelude::*;

and my polars is up to date as well:

polars = "0.30.0"
Arthur Zhang
  • 107
  • 8

1 Answers1

2

You need to enable lazy feature in Cargo.toml.

[dependencies]
polars = { version = "0.30.0", features = ["lazy"] }

Note: I could not find anything other than this in the official documentation, But I got this hint after looking at the source code of polars which defines it's prelude.rs file like this.

#[cfg(feature = "polars-algo")]
pub use polars_algo::prelude::*;
pub use polars_core::frame::groupby::*;
pub use polars_core::prelude::*;
pub use polars_core::utils::NoNull;
#[cfg(feature = "polars-io")]
pub use polars_io::prelude::*;
#[cfg(feature = "lazy")]
pub use polars_lazy::prelude::*; //`col` comes from `polars_lazy` crate
pub use polars_ops::prelude::*;
#[cfg(feature = "temporal")]
pub use polars_time::prelude::*;
Abdul Niyas P M
  • 18,035
  • 2
  • 25
  • 46