diff --git a/doc/source/user_guide/groupby.rst b/doc/source/user_guide/groupby.rst index 4ec34db6ed959..40369bd40cdb5 100644 --- a/doc/source/user_guide/groupby.rst +++ b/doc/source/user_guide/groupby.rst @@ -137,7 +137,7 @@ We could naturally group by either the ``A`` or ``B`` columns, or both: ``df.groupby('A')`` is just syntactic sugar for ``df.groupby(df['A'])``. -The above GroupBy will split the DataFrame on its index (rows). To split by columns, first do +DataFrame groupby always operates along axis 0 (rows). To split by columns, first do a transpose: .. ipython:: diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 68ea6795d47dd..e629ea43da79a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9432,7 +9432,7 @@ def groupby( index. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups (the Series' values are first aligned; see ``.align()`` method). If a list or ndarray of length - equal to the selected axis is passed (see the `groupby user guide + equal to the number of rows is passed (see the `groupby user guide `_), the values are used as-is to determine the groups. A label or list of labels may be passed to group by the columns in ``self``.