Crates.io | combee |
lib.rs | combee |
version | 0.6.0 |
source | src |
created_at | 2023-08-17 16:59:52.172046 |
updated_at | 2023-08-25 01:21:00.075271 |
description | Combee is a flexible data analysis library written in pure Rust inspired by pandas (python). |
homepage | https://github.com/DanielSanRocha/combee |
repository | https://github.com/DanielSanRocha/combee |
max_upload_size | |
id | 947251 |
size | 53,771 |
Combee is a strong typed data analysis library written in pure Rust inspired by pandas (python).
Run in a Rust project directory:
cargo add combee
Check the notebook using evcxr_jupyter on notebooks/analysis.ipynb to an example of analysis of dataset.
Below an example of loading a CSV file, filtering the dataset, and applying a function to each row:
(dataset.csv)
name,age
Daniel,26
Sergio,30
Leticia,22
(main.rs)
use serde::{Serialize, Deserialize};
use combee::{read_csv, dataframe::DataFrame};
#[derive(Clone, Deserialize, Serialize)]
struct Data {
name: String,
age: u32
}
let df = read_csv::<Data>(String::from("../tests/fixtures/basic.csv")).unwrap();
let df_filtered: DataFrame<Data> = df.filter(|row| row.age < 27);
let df_message: DataFrame<String> = df_filtered.apply(|row| format!("Hello {} with {} years!", row.name, row.age));
let messages = df_message.take(2);
println!("{}", messages[0]);
println!("{}", messages[1]);
(main.rs)
use serde::{Serialize, Deserialize};
use combee::{read_csv, functions::{mean, sum, count, all}};
#[derive(Clone, Deserialize, Serialize)]
struct Data {
name: String,
age: u32
}
fn main() {
let df = read_csv::<Data>(String::from("dataset.csv")).unwrap();
let stats = df.groupby(all).agg(|_, g|
(count(g), mean(g, |x| x.age), sum(g, |x| x.age))
).head(1);
println("{:?}", stats);
}
Daniel Santana: Made with Love 💗.
ali5h: Code to deserialize parquet row link.