rust极坐标将字符串列转换为日期时间 |
您所在的位置:网站首页 › rustp › rust极坐标将字符串列转换为日期时间 |
我正在学习rust并使用polars。我有一个简单的CSV文件 names,pdate,orders alice,2023-02-12,2 alice,2023-02-18,1 alice,2023-02-22,6 bob,2022-12-10,1 bob,2022-12-14,1 bob,2022-12-30,4我在使用中读到的 let mut df = CsvReader::from_path("t2.csv") .unwrap() .has_header(true) .finish() .unwrap(); println!("{}", df);它会打印出预期的结果。但是,我想将列pdate转换为一个日期,以便进一步使用它计算日期。我尝试了解决方案here let dt_options = StrpTimeOptions { date_dtype: DataType::Date, fmt: Some("%Y-%m-%d".into()), ..Default::default() }; let df = df.with_column(col("pdate").str().strptime(dt_options));cargo check出现以下错误 Checking test v0.1.0 (/home/xxxx/a1/rustp) error[E0277]: the trait bound `Expr: IntoSeries` is not satisfied --> test.rs:37:29 | 37 | let df = df.with_column(col("pdate").str().strptime(dt_options)); | ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoSeries` is not implemented for `Expr` | | | required by a bound introduced by this call | = help: the following other types implement trait `IntoSeries`: Arc |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |