Rust polars お試し
Cargo.tomlを以下のように指定
[package]
name = "polars_project"
version = "0.1.0"
edition = "2021"
[dependencies]
polars = "0.43.1"
サンプルコード
use polars::prelude::*;
fn main() -> Result<(), PolarsError> {
// サンプルデータフレームの作成
let df = df! [
"A" => [1, 2, 3, 4, 5],
"B" => ["a", "b", "c", "d", "e"]
]?;
println!("{}", df);
Ok(())
}
結果
$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.22s
Running `target\debug\polars_project.exe`
shape: (5, 2)
┌─────┬─────┐
│ A ┆ B │
│ --- ┆ --- │
│ i32 ┆ str │
╞═════╪═════╡
│ 1 ┆ a │
│ 2 ┆ b │
│ 3 ┆ c │
│ 4 ┆ d │
│ 5 ┆ e │
└─────┴─────┘