BUG:Time Grouper bug fix when applied for list groupers
State: closed

- [x] closes #17530
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry 
* save the axis indexer for Base/BinGrouper. As BinGrouper has get the sorted labels, need to use indexer to reorder them into right place for unsorted axis values
* add label_info property to get unsorted labels
* enable Grouping to use Base/BinGrouper instance generated by _get_grouper. Get label_info and group_info to get right labels and label indexes from Base/BinGrouper instance
* add test for #17530
* add comment

Labels:
name: Bug
name: Groupby
name: Resample
description: resample method

Comments:
Hello @ruiann! Thanks for updating the PR.







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

##### Comment last updated on October 01, 2017 at 15:43 Hours UTC
The PEP8 errors reported are not caused by my code, and also hard to change.
@ruiann I saw some comments that you had trouble installing the env.

- there is a bug in the docs w.r.t the recent addition of ``moto``; simply remove this from the ``requirements.txt`` when ``conda install -f requirements.txt -c conda-forge``, and then ``pip install moto``; there is an issue to fix the docs
- upgraded pytest, we require >= 3.1 (this is in the docs / requirements)
- the flake errors are in your code
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=h1) Report
> Merging [#17587](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0e85ca7f5afb26880e81ba6ff3965c8c0f27bbaf?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `95.65%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17587      +/-   ##
==========================================
- Coverage   91.22%   91.19%   -0.03%     
==========================================
  Files         163      163              
  Lines       49625    49620       -5     
==========================================
- Hits        45270    45252      -18     
- Misses       4355     4368      +13
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.98% <95.65%> (-0.01%)` | :arrow_down: |
| #single | `40.19% <8.69%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.26% <100%> (+0.09%)` | :arrow_up: |
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92% <95.23%> (-0.23%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.77% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17587?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/17587?src=pr&el=footer). Last update [0e85ca7...026223a](https://codecov.io/gh/pandas-dev/pandas/pull/17587?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/17587?src=pr&el=h1) Report
> Merging [#17587](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7d4a260cbe6d5c1825541adcd0d5310f32a3ba42?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `96.15%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17587      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.03%     
==========================================
  Files         163      163              
  Lines       49779    49777       -2     
==========================================
- Hits        45428    45413      -15     
- Misses       4351     4364      +13
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.02% <96.15%> (-0.01%)` | :arrow_down: |
| #single | `40.32% <15.38%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.14% <100%> (+0.08%)` | :arrow_up: |
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92.04% <95.83%> (-0.22%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17587?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |

------

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

@jreback 
There is a test failure in plotting/test_misc.py, I've tried this test but success. So what to do now?
whatsnew note 
@ruiann just waiting for a whatsnew note
@jreback 
I'm sorry but I don't know how to write a good one.😂 I've list all my changes in whatsnew entry.
need a 1-line entry in ``pandas/source/doc/whatsnew/v0.21.0.txt`` its a Bug Fix. in the grouping sub-section.
thanks @ruiann !

as discussed above, happy to have a PR to try to clean up some of the internal logic !