DOC/ERR: better error message on no common merge keys
State: closed

- [o] closes #19391 
- [o] tests passed
- [o] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- Let MergeError emit values keyword arguments
- Add `DataFrame.join` on `See also` section of  `pandas.merge`


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
It seems that the failed test has nothing to do with the content of the commit though..
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19427?src=pr&el=h1) Report
> Merging [#19427](https://codecov.io/gh/pandas-dev/pandas/pull/19427?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/54f1b3eca094e0b98d6d2b93854f9c937394109d?src=pr&el=desc) will **decrease** coverage by `1.63%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #19427      +/-   ##
==========================================
- Coverage    91.6%   89.96%   -1.64%     
==========================================
  Files         150      150              
  Lines       48750    48726      -24     
==========================================
- Hits        44657    43837     -820     
- Misses       4093     4889     +796
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.96% <100%> (-0.01%)` | :arrow_down: |
| #single | `?` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19427?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.42% <ø> (-0.01%)` | :arrow_down: |
| [pandas/core/reshape/merge.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZXJnZS5weQ==) | `94.21% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `62.5% <0%> (-29.88%)` | :arrow_down: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `64.17% <0%> (-28.28%)` | :arrow_down: |
| [pandas/io/feather\_format.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2ZlYXRoZXJfZm9ybWF0LnB5) | `71.42% <0%> (-14.29%)` | :arrow_down: |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `78.57% <0%> (-7.15%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `84.27% <0%> (-4.39%)` | :arrow_down: |
| [pandas/io/formats/console.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvY29uc29sZS5weQ==) | `66.66% <0%> (-3.04%)` | :arrow_down: |
| [pandas/io/clipboard/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9jbGlwYm9hcmRzLnB5) | `29.88% <0%> (-2.3%)` | :arrow_down: |
| [pandas/io/formats/printing.py](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvcHJpbnRpbmcucHk=) | `87.61% <0%> (-1.77%)` | :arrow_down: |
| ... and [35 more](https://codecov.io/gh/pandas-dev/pandas/pull/19427/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19427?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/19427?src=pr&el=footer). Last update [54f1b3e...e4c5b58](https://codecov.io/gh/pandas-dev/pandas/pull/19427?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Can you add a test for this, and a release note?

What's the output look like for large DataFrames? Does the repr truncation work correctly?
Release note added, `see also` modified.
I believe my contribution is about the error message. Should the error message be included in the test?
It seems that there already exists a test for [a merge with no common keys](https://github.com/pandas-dev/pandas/blob/fb3b23782534c925ab7158c59dcb32c8f8390d71/pandas/tests/reshape/merge/test_merge.py#L266).
I don't get what you said about the large DataFrames. Could you explain a bit more? 

> I believe my contribution is about the error message. Should the error message be included in the test?

Yes, see `pandas.util.testing.assert_raises_regex` for how to do it. You'll want to do a few different tests and assert that the correct information is always in the exception message.

Ignore my comment about large dataframes I think.
can you rebase and update
The line break and the order of options are modified.
Added a check for error message by `assert_raises_regex`.
thanks @swyoon 
thanks for kind reviews! @jreback @TomAugspurger