Skip to content

DOC : Updated the comparison with spreadsheets with GroupBy #39965

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

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/source/_static/spreadsheets/group-by.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,27 @@ In Excel, there are `merging of tables can be done through a VLOOKUP
* It will include all columns from the lookup table, instead of just a single specified column
* It supports :ref:`more complex join operations <merging.join>`

GroupBy
-------

In Excel, this can be done by using the `Query Editor <hhttps://support.microsoft.com/en-us/office/about-power-query-in-excel-7104fbee-9e62-4cb9-a02e-5bfb1a6c536a>`_.

.. image:: ../../_static/spreadsheets/group-by.png
Copy link
Member

Choose a reason for hiding this comment

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

Right now, this section duplicates content from the canonical documentation, which doesn't add any value. I suggest we either:

  • Walk them through an example in Excel that matches the pandas example below, so we are comparing apples to apples
  • Cut from "Then using the…" through this image

Copy link
Member

Choose a reason for hiding this comment

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

@afeld - are you good here?

Copy link
Member

Choose a reason for hiding this comment

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

Reviewing this again, I see that the requested change was not made. I also agree that having an excel example that matches the pandas example would be desirable.

Copy link
Member

Choose a reason for hiding this comment

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

@Bhard27 Are you able to update the excel image to match the pandas example below?


The equivalent in pandas:
We can use :meth:`~DataFrame.groupby`.
For example -

.. ipython:: python

df = pd.DataFrame(
{
'Animal': ['Falcon', 'Falcon', 'Parrot', 'Parrot'],
'Max Speed': [380., 370., 24., 26.],
}
)
Copy link
Member

Choose a reason for hiding this comment

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

We have an outstanding task in #38990 around standardizing the example datasets used in the page. Totally fine to take care of that as follow-up; just noting.

df
df.groupby(['Animal']).mean()

Other considerations
--------------------
Expand Down