Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correlation df.corr() from Python API #295

Open
l0uisgrange opened this issue Nov 22, 2024 · 1 comment
Open

Correlation df.corr() from Python API #295

l0uisgrange opened this issue Nov 22, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@l0uisgrange
Copy link

Correlation

I would really like to see the original df.corr() from Polars, because now we only have df.pearsonCorr(a, b), which need 2 columns. I would like to have df.corr(), which returns the correlation between every pair of columns in the dataframe.

Here is a usage example

let df = pl.DataFrame({foo: [1, 2, 3], bar: [3, 2, 1], ham: [7, 8, 9]})
console.log(df.corr());

//  shape: (3, 3)
//  ┌──────┬──────┬──────┐
//  │ foo  ┆ bar  ┆ ham  │
//  │ ---  ┆ ---  ┆ ---  │
//  │ f64  ┆ f64  ┆ f64  │
//  ╞══════╪══════╪══════╡
//  │ 1.0  ┆ -1.0 ┆ 1.0  │
//  │ -1.0 ┆ 1.0  ┆ -1.0 │
//  │ 1.0  ┆ -1.0 ┆ 1.0  │
//  └──────┴──────┴──────┘

Here is the link to the Python API :

@l0uisgrange l0uisgrange changed the title Correlation Correlation df.corr() from Python API Nov 22, 2024
@l0uisgrange l0uisgrange changed the title Correlation df.corr() from Python API Correlation df.corr() from Python API Nov 22, 2024
@Bidek56 Bidek56 added the enhancement New feature or request label Nov 22, 2024
@Bidek56
Copy link
Collaborator

Bidek56 commented Nov 22, 2024

Python version of df.corr() uses np.corrcoef. Do you know if there's a small Rust equivalent?
Adding correlation_rust to this project is probably out of scope.

@Bidek56 Bidek56 added good first issue Good for newcomers help wanted Extra attention is needed labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants