DOC GH22893 Fix docstring of groupby in pandas/core/generic.py
State: closed

- [x] closes #22893 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Updated docstring following https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html

I changed the examples into similar ones that I thought better demonstrated the function, but I'm willing to change them again if they aren't up to par.

I also might need some help describing the kwargs. It only accepts 'mutated' as a keyword argument and I can't tell if it does anything. Apologies if the answer is obvious!


Labels:
name: Docs
name: Groupby

Comments:
Hello @tonytao2012! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/generic.py`](https://github.com/tonytao2012/pandas/blob/a02652fc4c3fd54991ce161c34be8e9e6abfbcf5/pandas/core/generic.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22920?src=pr&el=h1) Report
> Merging [#22920](https://codecov.io/gh/pandas-dev/pandas/pull/22920?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2f1b842119bc4d5242b587b62bde71d8f7ef19f8?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #22920      +/-   ##
==========================================
+ Coverage   92.18%   92.19%   +<.01%     
==========================================
  Files         169      169              
  Lines       50830    50833       +3     
==========================================
+ Hits        46860    46863       +3     
  Misses       3970     3970
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <ø> (ø)` | :arrow_up: |
| #single | `42.37% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22920?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/22920/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.67% <ø> (ø)` | :arrow_up: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22920/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `85.22% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/22920/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.11% <0%> (+0.01%)` | :arrow_up: |

------

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

Thank you for the feedback. I believe those issues have been fixed.
Edit: Actually, changing the examples again, sorry. Didn't realize animals was the norm.
Oh, ok. Do you still want me to change the examples to be more consistent with convention?
I think at some point it'd be nice to use very similar examples in all documentation, but we're far from it. Feel free to change them if you want, but no need.
Went ahead and did it, thanks for all of the feedback!
Thanks @tonytao2012 looks great!
Thanks @tonytao2012 !