diff --git a/doc/source/_static/spreadsheets/group-by.png b/doc/source/_static/spreadsheets/group-by.png new file mode 100644 index 0000000000000..984d4e55df33d Binary files /dev/null and b/doc/source/_static/spreadsheets/group-by.png differ diff --git a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst index bdd0f7d8cfddf..a873e671d035b 100644 --- a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst +++ b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst @@ -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 ` +GroupBy +------- + +In Excel, this can be done by using the `Query Editor `_. + +.. image:: ../../_static/spreadsheets/group-by.png + +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.], + } + ) + df + df.groupby(['Animal']).mean() Other considerations --------------------