-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
DOC: Add cookbook entry using callable method for DataFrame.corr #22761
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the distance correlation you provided different from: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.spatial.distance.correlation.html ?
While the example looks interesting, it doesn't seem enough related to pandas to be worth adding it to our cookbook.
If the function in scipy is the same as the one you implemented, it could be nice having this example (using the scipy function) in the DataFrame.corr
docstring.
What do you think?
doc/source/cookbook.rst
Outdated
b = np.zeros(shape=(n, n)) | ||
|
||
for i in range(n): | ||
for j in range(i+1, n): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing spaces around +
doc/source/cookbook.rst
Outdated
b[i, j] = abs(y[i] - y[j]) | ||
|
||
a = a + a.T | ||
b = b + b.T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a += a.T
is more Pythonic
The function from |
Codecov Report
@@ Coverage Diff @@
## master #22761 +/- ##
==========================================
- Coverage 92.18% 92.18% -0.01%
==========================================
Files 169 169
Lines 50830 50820 -10
==========================================
- Hits 46860 46850 -10
Misses 3970 3970
Continue to review full report at Codecov.
|
I think this will be good to have. We'll need to wait for #22684 first. |
Sorry @dsaxton, I didn't see the related issue (next time it may be a good idea to leave the template we have in the PR description, it makes it easier to see there is a related issue). |
@dsaxton : Can you rebase onto |
@dsaxton seems like something went wrong with git, and your PR contains many unrelated changes. Can you take a look? In general that could be fixed by performing being in the PR branch:
Thanks! |
@datapythonista Sorry about that, could this have been caused by my rebase? I'll try the commands you're suggesting. |
@dsaxton it happens often to many people, but I'm not quite sure what's the cause. |
thanks @dsaxton |
@jreback NP, happy to help |
Provides a cookbook entry using the callable method option for
DataFrame.corr
(PR #22684) to calculate a distance correlation matrix. (Related: issue #22402)