Struct combee::dataframe::DataFrame

source ·
pub struct DataFrame<D: Clone + DeserializeOwned + Serialize> { /* private fields */ }
Expand description

A DataFrame is the main data structure of combee.

Implementations§

source§

impl<D: Clone + DeserializeOwned + Serialize> DataFrame<D>

source

pub fn new(data: Vec<D>) -> Self

Instatiante a new DataFrame.

source

pub fn take(&self, num: usize) -> Vec<D>

Returns a vector with the first ‘num’ rows of this DataFrame.

source

pub fn head(&self, num: usize) -> SliceDataFrame<'_, D>

Returns a new DataFrame with the first ‘num’ rows of this DataFrame.

source

pub fn len(&self) -> usize

Return the number of rows of the DataFrame.

source

pub fn apply<S: Clone + DeserializeOwned + Serialize, F>( &self, func: F ) -> DataFrame<S>where F: Fn(&D) -> S,

Apply a function for each row of a DataFrame and returns a new DataFrame.

source

pub fn filter<F>(&self, func: F) -> Selfwhere F: Fn(&D) -> bool,

Filter the DataFrame with the condition given by the closure parameter.

source

pub fn sort<F>(&self, comp: F) -> Selfwhere F: Fn(&D, &D) -> bool,

Sort the DataFrame by a comparison function and returns a new DataFrame sorted. This sorting algorithm is not stable, i.e, does not preserve the order of equal elements.

source

pub fn groupby<F, I: Eq + Hash + Clone>( &self, index: F ) -> GroupedDataFrame<'_, D, I, F>where F: Fn(&D) -> I,

Group DataFrame by index function.

source

pub fn find<F>(&self, condition: F) -> Option<&D>where F: Fn(&D) -> bool,

Find a row in the dataframe given a condition.

source

pub fn to_csv(&self, path: String) -> Result<(), Error>

Save a DataFrame as a CSV file.

source

pub fn to_parquet(&self, path: String) -> Result<(), Error>

Save a DataFrame as a Parquet file.

Auto Trait Implementations§

§

impl<D> RefUnwindSafe for DataFrame<D>where D: RefUnwindSafe,

§

impl<D> Send for DataFrame<D>where D: Send,

§

impl<D> Sync for DataFrame<D>where D: Sync,

§

impl<D> Unpin for DataFrame<D>where D: Unpin,

§

impl<D> UnwindSafe for DataFrame<D>where D: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for Twhere T: RefUnwindSafe + Send + Sync,