I’m trying to read a csv file and add a row filter. But I’m getting error when compiling with “Lazy” option on Polars. What am I doing wrong?
The toml file is:
<code>[package]
name = "test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
#Error:
#polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
#Works:
polars = { git = "https://github.com/pola-rs/polars" }
#Error:
#polars = { version = "0.40.0", features = ["csv-file","lazy"] }
#Works
#polars = "0.40.0"
</code>
<code>[package]
name = "test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
#Error:
#polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
#Works:
polars = { git = "https://github.com/pola-rs/polars" }
#Error:
#polars = { version = "0.40.0", features = ["csv-file","lazy"] }
#Works
#polars = "0.40.0"
</code>
[package]
name = "test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
#Error:
#polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
#Works:
polars = { git = "https://github.com/pola-rs/polars" }
#Error:
#polars = { version = "0.40.0", features = ["csv-file","lazy"] }
#Works
#polars = "0.40.0"
The error is:
For
<code>polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
</code>
<code>polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
</code>
polars = { git = "https://github.com/pola-rs/polars",features = ["lazy"] }
I got
<code>error[E0412]: cannot find type `CloudOptions` in this scope
</code>
<code>error[E0412]: cannot find type `CloudOptions` in this scope
</code>
error[E0412]: cannot find type `CloudOptions` in this scope
For
<code>polars = { version = "0.40.0", features = ["csv-file","lazy"] }
</code>
<code>polars = { version = "0.40.0", features = ["csv-file","lazy"] }
</code>
polars = { version = "0.40.0", features = ["csv-file","lazy"] }
I got
<code>error: failed to select a version for `polars`.
... required by package `dicionario_tm v0.1.0`
versions that meet the requirements `^0.40.0` are: 0.40.0
the package `test` depends on `polars`, with features: `csv-file` but `polars` does not have these features.
</code>
<code>error: failed to select a version for `polars`.
... required by package `dicionario_tm v0.1.0`
versions that meet the requirements `^0.40.0` are: 0.40.0
the package `test` depends on `polars`, with features: `csv-file` but `polars` does not have these features.
</code>
error: failed to select a version for `polars`.
... required by package `dicionario_tm v0.1.0`
versions that meet the requirements `^0.40.0` are: 0.40.0
the package `test` depends on `polars`, with features: `csv-file` but `polars` does not have these features.
What I’m trying to run:
(the idea of the following code is to read two csv files, join them and then filter some rows by a collumn id)
<code>use polars::prelude::*;
fn read_csv(filename:&str) -> DataFrame {
let parse_options = CsvParseOptions::default()
.with_separator(b';');
let reader = CsvReadOptions::default()
.with_has_header(true)
.with_parse_options(parse_options)
.try_into_reader_with_file_path(Some(filename.into()))
.unwrap();
reader.finish().unwrap()
}
fn main() {
let df1 = read_csv("file1.csv");
let df2 = read_csv("file2.csv");
let mut df3 = df1.join(&df2,
["ID"],
["ID"] ,
JoinArgs::new(JoinType::Inner))
.unwrap()
.select(["ID", "AA", "BB", "CC"])
.unwrap()
;
df3 = df3.filter(
col("ID").eq(lit(1))
).collect();
println!("{:?}", df3);
}
</code>
<code>use polars::prelude::*;
fn read_csv(filename:&str) -> DataFrame {
let parse_options = CsvParseOptions::default()
.with_separator(b';');
let reader = CsvReadOptions::default()
.with_has_header(true)
.with_parse_options(parse_options)
.try_into_reader_with_file_path(Some(filename.into()))
.unwrap();
reader.finish().unwrap()
}
fn main() {
let df1 = read_csv("file1.csv");
let df2 = read_csv("file2.csv");
let mut df3 = df1.join(&df2,
["ID"],
["ID"] ,
JoinArgs::new(JoinType::Inner))
.unwrap()
.select(["ID", "AA", "BB", "CC"])
.unwrap()
;
df3 = df3.filter(
col("ID").eq(lit(1))
).collect();
println!("{:?}", df3);
}
</code>
use polars::prelude::*;
fn read_csv(filename:&str) -> DataFrame {
let parse_options = CsvParseOptions::default()
.with_separator(b';');
let reader = CsvReadOptions::default()
.with_has_header(true)
.with_parse_options(parse_options)
.try_into_reader_with_file_path(Some(filename.into()))
.unwrap();
reader.finish().unwrap()
}
fn main() {
let df1 = read_csv("file1.csv");
let df2 = read_csv("file2.csv");
let mut df3 = df1.join(&df2,
["ID"],
["ID"] ,
JoinArgs::new(JoinType::Inner))
.unwrap()
.select(["ID", "AA", "BB", "CC"])
.unwrap()
;
df3 = df3.filter(
col("ID").eq(lit(1))
).collect();
println!("{:?}", df3);
}
I believe that I got the latest version of rust:
<code>$ rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.78.0 (9b00956e5 2024-04-29)
</code>
<code>$ rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.78.0 (9b00956e5 2024-04-29)
</code>
$ rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.78.0 (9b00956e5 2024-04-29)