pub struct DataFrame { /* private fields */ }Expand description
A dataframe struct similar to pythons pandas dataframe but with less functionality and only for integers The dataframe is stored as a vector of vectors The first vector contains the column names The rest of the vectors contain the data The data is stored as a vector of vectors
Example
use numbers_rus::DataFrame;
let mut df = DataFrame::new();
df.add_column("a", &vec![1, 2, 3]);
df.add_column("b", &vec![4, 5, 6]);
df.add_column("c", &vec![7, 8, 9]);Implementations§
source§impl DataFrame
impl DataFrame
sourcepub fn add_column(&mut self, name: &str, data: &Vec<i128>)
pub fn add_column(&mut self, name: &str, data: &Vec<i128>)
Adds a column to the dataframe
sourcepub fn get_columns(&self) -> Vec<String>
pub fn get_columns(&self) -> Vec<String>
Returns the column names
sourcepub fn get_column(&self, name: &str) -> Result<Vec<i128>, &'static str>
pub fn get_column(&self, name: &str) -> Result<Vec<i128>, &'static str>
Returns the column names
sourcepub fn get_column_index(&self, name: &str) -> Result<i128, &'static str>
pub fn get_column_index(&self, name: &str) -> Result<i128, &'static str>
Returns the column names
sourcepub fn get_column_name(&self, index: i128) -> Result<String, &'static str>
pub fn get_column_name(&self, index: i128) -> Result<String, &'static str>
Returns the column names
sourcepub fn get_column_count(&self) -> i128
pub fn get_column_count(&self) -> i128
Returns the column names
sourcepub fn get_row_count(&self) -> usize
pub fn get_row_count(&self) -> usize
Returns the column names