COMPAT: Emit warning when groupby by a tuple
Closes https://github.com/pandas-dev/pandas/issues/18314
cc @toobaz  # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18731?src=pr&el=h1) Report
> Merging [#18731](https://codecov.io/gh/pandas-dev/pandas/pull/18731?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fb178fc5e9793a0684d486c37d5bd8c2c54bcbf5?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #18731      +/-   ##
==========================================
- Coverage   91.64%   91.62%   -0.02%     
==========================================
  Files         154      154              
  Lines       51401    51408       +7     
==========================================
- Hits        47106    47104       -2     
- Misses       4295     4304       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.49% <100%> (ø)` | :arrow_up: |
| #single | `40.83% <0%> (-0.13%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18731?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/18731/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92.07% <100%> (+0.02%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18731/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18731/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.68% <0%> (-0.11%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18731?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/18731?src=pr&el=footer). Last update [fb178fc...3057aab](https://codecov.io/gh/pandas-dev/pandas/pull/18731?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Hello @TomAugspurger! Thanks for updating the PR.

 - In the file [`pandas/core/groupby.py`](https://github.com/pandas-dev/pandas/blob/3057aabaf6aae34e9bd902bde7bf00fa8e57276a/pandas/core/groupby.py), following are the PEP8 issues :

> [Line 2866:17](https://github.com/pandas-dev/pandas/blob/3057aabaf6aae34e9bd902bde7bf00fa8e57276a/pandas/core/groupby.py#L2866): [W503](https://duckduckgo.com/?q=pep8%20W503) line break before binary operator





##### Comment last updated on December 18, 2017 at 12:53 Hours UTC Huh about the example:

```python
df = pd.DataFrame(1, index=range(3), columns=pd.MultiIndex.from_product([[1, 2], [3,4]]))
df.groupby((7, 8)).mean()
```

On master that gives me

```python
Out[4]:
   1     2
   3  4  3  4
7  1  1  1  1
8  1  1  1  1

```

Is that correct? That seems like it should throw a KeyError, right?

Opened https://github.com/pandas-dev/pandas/issues/18798 for that. OK, updated to use your suggestion @toobaz, with a slight modification so that we warn when either

1. the tuple isn't a valid key and elements are hashable and all of the elements are valid keys
2. any of the elements are not hashable

 Yeah, I think that's perfect (I had forgot case 2.). Two small comments:
- you could replace ``all(is_hashable(x) for x in key)`` with ``is_hashable(key)`` - but without significant performance gain, so not sure it's an improvement
- the [duplicated test](https://github.com/pandas-dev/pandas/pull/18731#discussion_r156228903) is still there Thanks, fixed. Should be good to go hopefully. lgtm. needs a rebase to fix conflict. merge on green.