Skip to content

Commit

Permalink
Refactor: s_correlation (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe authored Dec 15, 2023
1 parent 315911e commit 5d58090
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions native/explorer/src/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,13 +1026,11 @@ pub fn s_correlation(
let corr = match method {
ExCorrelationMethod::Pearson => pearson_corr(s1.f64()?, s2.f64()?, ddof),
ExCorrelationMethod::Spearman => {
let df = df!("s1" => s1, "s2" => s2)?;
let lazy_df = df
let df = df!("s1" => s1, "s2" => s2)?
.lazy()
.with_column(spearman_rank_corr(col("s1"), col("s2"), ddof, true).alias("corr"));
let result = lazy_df.collect()?;
let item = result.column("corr")?.get(0)?;
match item {
.with_column(spearman_rank_corr(col("s1"), col("s2"), ddof, true).alias("corr"))
.collect()?;
match df.column("corr")?.get(0)? {
AnyValue::Float64(x) => Some(x),
_ => None,
}
Expand Down

0 comments on commit 5d58090

Please sign in to comment.