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§
Sourcefn eval(&self, expr_str: &str) -> Result<Series, ExprError>
fn eval(&self, expr_str: &str) -> Result<Series, ExprError>
Evaluate an expression string in the context of this DataFrame.
Matches pd.DataFrame.eval(expr).
Sourcefn eval_with_locals(
&self,
expr_str: &str,
locals: &BTreeMap<String, Scalar>,
) -> Result<Series, ExprError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".