Bug: groupby multiindex levels equals rows
Fix for GH16843 where groubpy gives wrong result when number of
groupedby index+columns is equal to length of axis

 closes #16843
 tests added
 passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff`` (On Windows, ``git diff upstream/master -u -- "*.py" | flake8 --diff`` might work as an alternative.)
 - [ ] whatsnew entry

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=h1) Report
> Merging [#16859](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/18f929fa83d2d1f335f8ccf325c05a6ce314b94d?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/16859/graphs/tree.svg?src=pr&height=150&width=650&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16859      +/-   ##
==========================================
- Coverage   90.98%   90.96%   -0.02%     
==========================================
  Files         161      161              
  Lines       49300    49300              
==========================================
- Hits        44857    44848       -9     
- Misses       4443     4452       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.74% <100%> (ø)` | :arrow_up: |
| #single | `40.18% <0%> (-0.07%)` | :arrow_down: |

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16859?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/16859?src=pr&el=footer). Last update [18f929f...acd449f](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=h1) Report
> Merging [#16859](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/58d872903449b8a29237288ade6227cdb280fe18?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/16859/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16859      +/-   ##
==========================================
- Coverage   91.03%   91.01%   -0.02%     
==========================================
  Files         162      162              
  Lines       49567    49567              
==========================================
- Hits        45123    45114       -9     
- Misses       4444     4453       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <100%> (ø)` | :arrow_up: |
| #single | `40.24% <0%> (-0.07%)` | :arrow_down: |

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16859?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/16859?src=pr&el=footer). Last update [58d8729...a98db9a](https://codecov.io/gh/pandas-dev/pandas/pull/16859?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Ok, lots red warnings now. I hope you have everything from me now for the PR. can you rebase and update for small comments. Hello @P-Tillmann! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on August 21, 2017 at 06:55 Hours UTC @jreback ping ;-)

Would you discourage the use of inplace option in general in favor of assigning back to the df? > Would you discourage the use of inplace option in general in favor of assigning back to the df?

Yes, see #16529. small changes suggest by @gfyoung look fine. otherwise lgtm. @jreback @jorisvandenbossche : Addressed my own comments.  PTAL. thanks!