Python's pandas implemented for fast, type safe programming in Rust.
CSV
returns CSV struct reading file from given path
rust
let mut content = String::new();
let csv : CSV = dataframe::df::read_csv("test.csv", &mut content); // CSV { headers, values, matrix }
returns DataFrame from a CSV struct
rust
let mut df = csv.get_df(); // DataFrame { columns, dataset, values }
DataFrame
returns array of strings, containing column names
rust
df.columns; // ["name","age"]
### .dataset -> Vecrust
df.dataset; // [["bob","30"]
["richard", "25"]]
### .values -> Vecrust
df.values; // [("name", ["bob", "richard"]), ("age", ["30", "25])]
### .max(column: &str) -> f64
returns max from all values inside a column
rust
df.max("age"); // 30 as f64
### .max(column: &str) -> f64
return min from all values inside a column
rust
df.min("age"); // 25 as f64
### .mean(column: &str) -> f64
return mean from all values inside a column
rust
df.mean("age"); // 27.5 as f64
### [&str] -> Vec<&str>
string index for DataFrame, returns all values from a given column
rust
df["age"]; // ["30", "25"]
### [usize] -> Vec<&str>
usize index for DataFrame, returns given row with all columns
rust
df[0]; // ["bob", "30"]
### .iloc(Vecrust
df.iloc([0..2, 0..1].to_vec()); // [["richard"], ["bob"]]
### .isnacol(column: &str) -> bool
returns if given column on DataFrame has a missing value
rust
df.is_na_col("age"); // false
### .is_na() -> bool
returns matrix containing missing value bool for each value
rust
df.is_na(); // [[false, false], [false, false]]
### .push(value: Vec<&str>)
returns matrix containing missing value bool for each value
rust
df.push(["ann", "20"]);
df.dataset; // [["richard", "30"], ["bob", "25"], ["ann", "20"]]
### .pop(value: Vec<&str>) -> Vec<&str>
returns matrix containing missing value bool for each value
rust
df.pop(); // ["ann", "20"]
df.pop(); // ["bob", "25"]
df.dataset; // [["richard", "30"]]
### .n_uniques(column: &str) -> usize
returns matrix containing missing value bool for each value
rust
df.n_uniques("age"); // 2 as usize
### .uniques(column: &str) -> Vec<&str>
returns matrix containing missing value bool for each value
rust
df.uniques("age"); // ["30", "25"]