Skip to main content

DataFrameOps

Trait DataFrameOps 

Source
pub trait DataFrameOps {
    type Output: DataFrameOps;
    type Error: Error + Send + Sync + 'static;

Show 18 methods // Required methods fn select(&self, columns: &[&str]) -> Result<Self::Output>; fn drop(&self, columns: &[&str]) -> Result<Self::Output>; fn rename(&self, mapping: &HashMap<String, String>) -> Result<Self::Output>; fn filter<F>(&self, predicate: F) -> Result<Self::Output> where F: Fn(&dyn DataValue) -> bool + Send + Sync; fn head(&self, n: usize) -> Result<Self::Output>; fn tail(&self, n: usize) -> Result<Self::Output>; fn sample( &self, n: usize, random_state: Option<u64>, ) -> Result<Self::Output>; fn sort_values( &self, by: &[&str], ascending: &[bool], ) -> Result<Self::Output>; fn sort_index(&self) -> Result<Self::Output>; fn shape(&self) -> (usize, usize); fn columns(&self) -> Vec<String>; fn dtypes(&self) -> HashMap<String, String>; fn info(&self) -> DataFrameInfo; fn dropna(&self, axis: Option<Axis>, how: DropNaHow) -> Result<Self::Output>; fn fillna( &self, value: &dyn DataValue, method: Option<FillMethod>, ) -> Result<Self::Output>; fn isna(&self) -> Result<Self::Output>; fn map<F>(&self, func: F) -> Result<Self::Output> where F: Fn(&dyn DataValue) -> Box<dyn DataValue> + Send + Sync; fn apply<F>(&self, func: F, axis: Axis) -> Result<Self::Output> where F: Fn(&Self::Output) -> Box<dyn DataValue> + Send + Sync;
}
Expand description

Base trait for all DataFrame-like structures in PandRS

Required Associated Types§

Required Methods§

Source

fn select(&self, columns: &[&str]) -> Result<Self::Output>

Select specific columns by name

Source

fn drop(&self, columns: &[&str]) -> Result<Self::Output>

Drop specific columns by name

Source

fn rename(&self, mapping: &HashMap<String, String>) -> Result<Self::Output>

Rename columns using a mapping

Source

fn filter<F>(&self, predicate: F) -> Result<Self::Output>
where F: Fn(&dyn DataValue) -> bool + Send + Sync,

Filter rows based on a predicate function

Source

fn head(&self, n: usize) -> Result<Self::Output>

Get the first n rows

Source

fn tail(&self, n: usize) -> Result<Self::Output>

Get the last n rows

Source

fn sample(&self, n: usize, random_state: Option<u64>) -> Result<Self::Output>

Sample n random rows

Source

fn sort_values(&self, by: &[&str], ascending: &[bool]) -> Result<Self::Output>

Sort by column values

Source

fn sort_index(&self) -> Result<Self::Output>

Sort by index

Source

fn shape(&self) -> (usize, usize)

Get the shape (rows, columns) of the DataFrame

Source

fn columns(&self) -> Vec<String>

Get the column names

Source

fn dtypes(&self) -> HashMap<String, String>

Get the data types of columns

Source

fn info(&self) -> DataFrameInfo

Get comprehensive DataFrame information

Source

fn dropna(&self, axis: Option<Axis>, how: DropNaHow) -> Result<Self::Output>

Drop rows or columns containing null values

Source

fn fillna( &self, value: &dyn DataValue, method: Option<FillMethod>, ) -> Result<Self::Output>

Fill null values

Source

fn isna(&self) -> Result<Self::Output>

Check for null values

Source

fn map<F>(&self, func: F) -> Result<Self::Output>
where F: Fn(&dyn DataValue) -> Box<dyn DataValue> + Send + Sync,

Apply a function to each element

Source

fn apply<F>(&self, func: F, axis: Axis) -> Result<Self::Output>
where F: Fn(&Self::Output) -> Box<dyn DataValue> + Send + Sync,

Apply a function along an axis

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> DataFrameOps for JitOptimizedDataFrame<T>
where T: DataFrameOps + Send + Sync + 'static, T::Output: Send + Sync + 'static,