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
1 change: 1 addition & 0 deletions ci/deps/azure-macos-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

- xarray
- xlrd
- xlsxwriter
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

from scipy.stats import kendalltau, spearmanr
elif callable(method):
return method
Expand Down