Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Improve groupby in the User Guide #51704

Merged
merged 10 commits into from
Mar 8, 2023

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Mar 1, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations 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.

@rhshadrach rhshadrach added this to the 2.0 milestone Mar 1, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Still need to properly read everything, but this looks like a really nice improvement

cc @DeaMariaLeon @natmokval in case you want to have a look (tagging you as you've both done several docs issues, so this may be of interest - no obligation though!)

@MarcoGorelli MarcoGorelli self-requested a review March 1, 2023 20:12
@DeaMariaLeon
Copy link
Member

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

@MarcoGorelli @rhshadrach

Copy link
Member Author

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DeaMariaLeon! Since this PR only touches aggregation, transformation, and filtration, 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?

I've taken your comments and added them inline here. For some, I made comments after them. If there is no comment, then I'm +1 on making the change. 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.

For the ones that have comments after, we should discuss further before making changes.

@DeaMariaLeon
Copy link
Member

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".

@DeaMariaLeon
Copy link
Member

@rhshadrach I did a PR to your branch.

rhshadrach and others added 3 commits March 4, 2023 08:01
…pby_userguide

� Conflicts:
�	doc/source/user_guide/groupby.rst
@rhshadrach
Copy link
Member Author

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.

@DeaMariaLeon
Copy link
Member

@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.

@rhshadrach
Copy link
Member Author

@MarcoGorelli - I think this is ready for review. @phofl - I believe you said you were planning to take a look.

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments

@rhshadrach rhshadrach requested a review from phofl March 6, 2023 02:10
Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

:meth:`~.DataFrameGroupBy.cov` * ;Compute the covariance of the groups
:meth:`~.DataFrameGroupBy.first`;Compute the first occurring value in each group
:meth:`~.DataFrameGroupBy.idxmax` *;Compute the index of the maximum value in each group
:meth:`~.DataFrameGroupBy.idxmin` *;Compute the index of the minimum value in each group
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird, does this render properly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@mroeschke mroeschke merged commit ff9c8f4 into pandas-dev:main Mar 8, 2023
@mroeschke
Copy link
Member

Nice improvements!

@lumberbot-app
Copy link

lumberbot-app bot commented Mar 8, 2023

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
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 ff9c8f4a56c243d4d7c101ed9d9d1da322eb5c59
  1. 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'
  1. Push to a named branch:
git push YOURFORK 2.0.x:auto-backport-of-pr-51704-on-2.0.x
  1. 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.

@MarcoGorelli
Copy link
Member

@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

MarcoGorelli added a commit that referenced this pull request Mar 9, 2023
…Guide) (#51857)

Backport PR #51704: DOC: Improve groupby in the User Guide

Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
@rhshadrach rhshadrach deleted the groupby_userguide branch April 2, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants