Skip to main content

DataFrameExprExt

Trait DataFrameExprExt 

Source
pub trait DataFrameExprExt {
    // Required methods
    fn eval(&self, expr_str: &str) -> Result<Series, ExprError>;
    fn eval_with_locals(
        &self,
        expr_str: &str,
        locals: &BTreeMap<String, Scalar>,
    ) -> Result<Series, ExprError>;
    fn query(&self, expr_str: &str) -> Result<DataFrame, ExprError>;
    fn query_with_locals(
        &self,
        expr_str: &str,
        locals: &BTreeMap<String, Scalar>,
    ) -> Result<DataFrame, ExprError>;
}
Expand description

Extension trait that adds eval() and query() methods directly to DataFrame.

Import this trait to call df.eval("a + b") and df.query("a > 1") directly. Uses a default hardened policy and fresh evidence ledger.

Required Methods§

Source

fn eval(&self, expr_str: &str) -> Result<Series, ExprError>

Evaluate an expression string in the context of this DataFrame.

Matches pd.DataFrame.eval(expr).

Source

fn eval_with_locals( &self, expr_str: &str, locals: &BTreeMap<String, Scalar>, ) -> Result<Series, ExprError>

Matches pd.DataFrame.eval(expr) with explicit @local scalar bindings.

Source

fn query(&self, expr_str: &str) -> Result<DataFrame, ExprError>

Filter rows by a boolean expression string.

Matches pd.DataFrame.query(expr).

Source

fn query_with_locals( &self, expr_str: &str, locals: &BTreeMap<String, Scalar>, ) -> Result<DataFrame, ExprError>

Matches pd.DataFrame.query(expr) with explicit @local scalar bindings.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DataFrameExprExt for DataFrame

Source§

fn eval(&self, expr_str: &str) -> Result<Series, ExprError>

Source§

fn eval_with_locals( &self, expr_str: &str, locals: &BTreeMap<String, Scalar>, ) -> Result<Series, ExprError>

Source§

fn query(&self, expr_str: &str) -> Result<DataFrame, ExprError>

Source§

fn query_with_locals( &self, expr_str: &str, locals: &BTreeMap<String, Scalar>, ) -> Result<DataFrame, ExprError>

Implementors§