问题描述
我想知道如何从镶木地板文件中按列 name 获取“item_id”和“idf_score”值。
我正在使用镶木地板 = "3.0"
fn stackoverflow_example(dir: &str) -> HashMap<u64,f64> {
let mut item_to_idf = HashMap::new();
let dir_entry = fs::read_dir(dir).unwrap();
for path in dir_entry {
let full_path_to_file = path.unwrap().path().display().to_string();
if full_path_to_file.ends_with(".parquet") {
let file = File::open(&Path::new(&full_path_to_file)).unwrap();
let reader = SerializedFileReader::new(file).unwrap();
let mut row_iter = reader.get_row_iter(None).unwrap();
while let Some(row) = row_iter.next() {
let item_id = row.get_long(0).unwrap() as u64;
let idf_score = row.get_double(1).unwrap();
item_to_idf.insert(item_id,idf_score);
}
}
}
item_to_idf
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)