DOC: Add cookbook entry using callable method for DataFrame.corr
State: closed

Provides a cookbook entry using the callable method option for `DataFrame.corr` (PR #22684) to calculate a distance correlation matrix.  (Related: issue #22402)

Labels:
name: Docs
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
The function from `scipy.spatial.distance` is taking one minus the ordinary Pearson correlation, so this is a different calculation.  The cookbook entry was requested by @TomAugspurger in #22402 and I think the goal was just to show the flexibility of allowing callable methods in `DataFrame.corr` while also being somewhat interesting in itself.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=h1) Report
> Merging [#22761](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f4fae353eaaa719db335ec2b21259932de30f46d?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22761/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=tree)

```diff
@@            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
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <ø> (-0.01%)` | :arrow_down: |
| #single | `42.38% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9iYXNlLnB5) | `91.11% <0%> (-0.73%)` | :arrow_down: |
| [pandas/plotting/\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb21wYXQucHk=) | `90.9% <0%> (-0.4%)` | :arrow_down: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.28% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `96.55% <0%> (-0.11%)` | :arrow_down: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.54% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/algorithms.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWxnb3JpdGhtcy5weQ==) | `94.69% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `95.12% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/strings.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3RyaW5ncy5weQ==) | `98.63% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `95.45% <0%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.2% <0%> (ø)` | :arrow_up: |
| ... and [5 more](https://codecov.io/gh/pandas-dev/pandas/pull/22761/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=footer). Last update [f4fae35...76584e4](https://codecov.io/gh/pandas-dev/pandas/pull/22761?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

I think this will be good to have.

We'll need to wait for https://github.com/pandas-dev/pandas/pull/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 `master` to fix the build issues?
@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:
```
git fetch upstream
git merge upstream/master
git reset --soft upstream/master
git commit -m "PR description"
git push -f
```

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