请问下,polars中iterator报错是因为什么,代码没改,甚至上午还运行成功了,下午就一直报这类错:
thread 'main' panicked at D:\my_programs\cargo_home\registry\src\index.crates.io-6f17d22bba15001f\polars-core-0.43.1\src\series\iterator.rs:88:9:
assertion `left == right` failed: impl error
left: 8
right: 1
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:665
1: core::panicking::panic_fmt
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\panicking.rs:74
2: core::panicking::assert_failed_inner
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\panicking.rs:405
3: core::panicking::assert_failed<usize,usize>
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\panicking.rs:365
4: polars_core::series::Series::iter
at D:\my_programs\cargo_home\registry\src\index.crates.io-6f17d22bba15001f\polars-core-0.43.1\src\series\iterator.rs:88
5: test_20250212::write_to_excel
at .\src\main.rs:149
6: test_20250212::main
at .\src\main.rs:57
7: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,alloc::boxed::Box<dyn$<core::error::Error>,alloc::alloc::Global> > > (*)(),tuple$<> >
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `E:\work_using_apps\cargo_target_dir\debug\test_20250212.exe` (exit code: 101)
报错相关代码如下:
for (col_idx, col_series) in df_matched.collect()?.get_columns().iter().enumerate() {
for (row_idx, data) in col_series.iter().enumerate() { <= 本行报错
println!("row_idx is {}, col_idx is {}, data is {}", row_idx, col_idx, data.to_string());;
}
}
- 其中,
df_matched
可以通过println!宏打印出来:df_matched is shape: (10_424, 12),但是就是无法通过上面那个二重循环遍历(明明早上还好好的,啊啊啊!!!!)
1
共 1 条评论, 1 页
评论区
写评论