Correlation Method Definitions (function_expr/correlation.rs)

polars · crates/polars-plan/src/dsl/function_expr/correlation.rs · rust · MIT
ai, analytics, lang:rust, tag:math

Enumerates statistical correlation methods like Pearson and Spearman. Use this to configure correlation calculations in data analysis pipelines.

// Source: https://github.com/pola-rs/polars | License: MIT | Copyright 2025 Ritchie Vink
// Provided via justclaw.it.com; keep this notice with the code.
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use super::*;

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
#[derive(Copy, Clone, PartialEq, Debug, Hash)]
pub enum CorrelationMethod {
    Pearson,
    #[cfg(all(feature = "rank", feature = "propagate_nans"))]
    SpearmanRank(bool),
    Covariance(u8),
}

impl Display for CorrelationMethod {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        use CorrelationMethod::*;
        let s = match self {
            Pearson => "pearson",
            #[cfg(all(feature = "rank", fe

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key