DOC: Improve groupby in the User Guide
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Reworks the aggregation, transformation, and filtration sections of the groupby user guide. The primary change is a greater emphasis on built-in methods and warning users that supplying UDFs to agg, transform, and filter is inefficient.



Labels:
name: Docs
name: Groupby

Comments:
I think I should just comment on Richard's edits, but since I have to read the whole document (to be able to understand) I may as well suggest other edits. 
So I converted Richard's document to html, and I'm attaching it as a pdf file. It has my first suggestions. 
I'm just in the middle of the document. 

Should I contribute my edits? If so, in this PR or in a separate PR? 
[Group by - documentation.pdf](https://github.com/pandas-dev/pandas/files/10874798/Group.by.-.documentation.pdf)

@MarcoGorelli @rhshadrach 

> I think we should separate off any requested changes outside of these sections into a separate PR. Would you be up for putting one up?

Sure



> If you'd like to push them to this branch, that'd work for me; otherwise I can make them directly - good either way just let me know.

Yes, I can (try) to do the push... I will now edit the things for which you were "+1". 
 
@rhshadrach I did a PR to your branch. 

Thanks @DeaMariaLeon - I merged your branch. A few of your comments remain to discuss; can you go through those above and let me know your thoughts.
@rhshadrach sorry I didn't comment earlier. It's just that I didn't see a problem. 

I will open a PR, as I said, with edits to the same document but on different sections. 
@MarcoGorelli - I think this is ready for review. @phofl - I believe you said you were planning to take a look.
Nice improvements!
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 2.0.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -x -m1 ff9c8f4a56c243d4d7c101ed9d9d1da322eb5c59
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #51704: DOC: Improve groupby in the User Guide'
```

4. Push to a named branch:

```
git push YOURFORK 2.0.x:auto-backport-of-pr-51704-on-2.0.x
```

5. Create a PR against branch 2.0.x, I would have named this PR:

> "Backport PR #51704 on branch 2.0.x (DOC: Improve groupby in the User Guide)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
> @MarcoGorelli - I think this is ready for review. @phofl - I believe you said you were planning to take a look.

apologies for not getting to this in time - great work anyway, I've done the backport