When I try to build the below code, I am receiving the error
error[E0599]: no method named str
found for enum Expr
in the current scope
41 | col("Name").str().ends_with(lit(" Common")).or(col("Name").str().ends_with(lit(" ADR")))
| ^^^
use polars::prelude::*;
use std::result::Result;
use std::sync::Arc;
fn get() -> Result<DataFrame, PolarsError> {
let dtypes = Schema::from_iter(
vec![
Field::new("Symbol", DataType::String),
Field::new("Name", DataType::String),
Field::new("Exchange", DataType::String)
]
);
let option_schema: Option<SchemaRef> = Some(Arc::new(dtypes));
let exc = vec!["Cboe BZX", "OTC"];
let df = LazyCsvReader::new("somepath/names.txt")
.with_has_header(true)
.with_schema(option_schema)
.finish()?
.filter(col("Exchange")
.is_in(lit(Series::new("exc", exc)))
.not()
.and(
col("Name").str().ends_with(lit(" Common")).or(col("Name").str().ends_with(lit(" ADR")))
)).collect()?;
Ok(df)
}
Thanks in advance for any help