ENH: add GroupBy.pipe method
State: closed

- [x ] closes #10353, see also #17863
- [x ] tests added / passed
- [ x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ x] whatsnew entry

This PR adds a ``.pipe`` method to GroupBy objects like for ``DataFrame.pipe`` and ``Series .pipe``.

This PR is basically #10466 written by @ghl3 with some very minor updates, because that PR somehow got stalled and subsequently was closed.

This PR says it's new in 0.21, but I'll change that if it's too late to add this.

Labels:
name: Enhancement
name: Groupby

Comments:
@topper-123 Thanks a lot for reviving this feature.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=h1) Report
> Merging [#17871](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5bf7f9a4ff6968fd444fa7098f8dc95586591994?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `50%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17871      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files         163      163              
  Lines       50105    50110       +5     
==========================================
+ Hits        45715    45723       +8     
+ Misses       4390     4387       -3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.05% <50%> (+0.02%)` | :arrow_up: |
| #single | `40.31% <16.66%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.53% <100%> (+0.33%)` | :arrow_up: |
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `91.99% <100%> (ø)` | :arrow_up: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `91.18% <33.33%> (-1.63%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.75% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.41% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `95.14% <0%> (ø)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17871?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.2% <0%> (+1.81%)` | :arrow_up: |

------

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

@jreback , I've made changes to the PR. Travis was green and newest forcepush is just for some linting issues.

@ghl3, well, thank you for writing most of this:-)
small change

@TomAugspurger @jorisvandenbossche @shoyer 


Had some git issue, so squashed all the commits.

I'm off to sleep, I'll look into eventual comments tomorrow.
The comments from @jorisvandenbossche have been addressed. Thanks for reviewing.
Hmm, I can see the newest code changes on my github repository, but they don't show up in the PR. Any suggestions on how to proceed?

for reference, the newest code her: https://github.com/topper-123/pandas/commit/8614c321c7b80608abf23029e04d10b3333c3e3c

**EDIT: never mind, it works now.**
I think you need to add in api.rst as well. if docs build ok, ping on green.
thanks @ghl3 and @topper-123 for the revival
Great work, @jreback and @topper-123