Skip to content

Added 'pearson' to methods list in pandas/core/nanops.py #30603

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

Merged
merged 10 commits into from
Jan 7, 2020

Conversation

ShaharNaveh
Copy link
Member

@ShaharNaveh ShaharNaveh changed the title Added 'pearson' to methods list Added 'pearson' to methods list in pandas/core/nanops.py Jan 1, 2020
@jreback jreback added the Code Style Code style, linting, code_checks label Jan 1, 2020
@@ -26,6 +26,7 @@ dependencies:
- pytables
- python-dateutil==2.6.1
- pytz
- scipy>=1.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, we should be skipping tests if the deps are not installed, which test is the issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, we should be skipping tests if the deps are not installed, which test is the issue?

pandas.tests.frame.methods.test_cov_corr.TestDataFrameCorrWith
test_moments_rolling.TestRollingMomentsConsistency
pandas.tests.frame.methods.test_cov_corr.TestDataFrameCorrWith
pandas.tests.test_nanops.TestnanopsDataFrame
pandas.tests.test_nanops.TestnanopsDataFrame
pandas.tests.frame.methods.test_cov_corr.TestDataFrameCorrWith
pandas.tests.series.test_timeseries.TestTimeSeries

For the macOS build, at least.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then these should have a skip in place

@ShaharNaveh ShaharNaveh marked this pull request as ready for review January 2, 2020 00:32
@ShaharNaveh ShaharNaveh requested a review from jreback January 2, 2020 00:33
@@ -1241,7 +1241,7 @@ def nancorr(a, b, method="pearson", min_periods=None):


def get_corr_func(method):
if method in ["kendall", "spearman"]:
if method in ["kendall", "spearman", "pearson"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actrually, why is this necessary at all? this just uses numpy and not scipy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You asked me to:)

ref - #30461 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh right, but this is not actually the correct check, instead do like

if method in ['kendall', 'spearman']:
   .....
elif method in ['pearson']:
    pass
elif callable(method):
   ....
else:
     raise ValueError("....in valid method passed')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise ValueError(f"Unrecognized method '{method}'")

Sounds good? (probably not, my English is not so good)

And also, should I remove all the "Skip" decorators Iv'e added in ed6f9c9 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure & yes remove the skips

elif callable(method):
return method
else:
raise ValueError(
f"Unkown method '{method}', expected one of 'kendall', 'spearman'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test that hits this (likely just calling .corr(method='foo') would do it

@ShaharNaveh ShaharNaveh closed this Jan 5, 2020
@ShaharNaveh ShaharNaveh reopened this Jan 5, 2020
@ShaharNaveh
Copy link
Member Author

Closed&Reopened because the build failed during compile time.

Checking if that was a false positive.

@jreback jreback added this to the 1.0 milestone Jan 7, 2020
@jreback jreback merged commit 3f57ae7 into pandas-dev:master Jan 7, 2020
@jreback
Copy link
Contributor

jreback commented Jan 7, 2020

thanks @MomIsBestFriend

@ShaharNaveh ShaharNaveh deleted the nanops-pearson branch January 8, 2020 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants