Skip to content

Commit b80ff17

Browse files
committed
Revert "DOC: Fix the following 'errors' (pandas-dev#24178):"
This reverts commit 41a2e47.
1 parent e5e05dc commit b80ff17

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

doc/source/groupby.rst

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,16 @@ See the :ref:`cookbook<cookbook.grouping>` for some advanced strategies.
6262
Splitting an object into groups
6363
-------------------------------
6464

65-
Pandas objects can be split on any of their axes. The abstract definition of
65+
pandas objects can be split on any of their axes. The abstract definition of
6666
grouping is to provide a mapping of labels to group names. To create a GroupBy
67-
object, see below (more on what the GroupBy object is later). A
68-
groupby can be applied in the following ways to a pandas object:
69-
70-
* grouped = obj.groupby(key)
71-
* grouped = obj.groupby(key, axis='columns')
72-
* grouped = obj.groupby([key1, key2])
67+
object (more on what the GroupBy object is later), you may do the following:
7368

7469
.. code-block:: python
7570
76-
df = pd.DataFrame(
77-
[('bird', 'Falconiformes', 389.0),
78-
('bird', 'Psittaciformes', 24.0),
79-
('mammal', 'Carnivora', 80.2),
80-
('mammal', 'Primates', np.nan),
81-
('mammal', 'Carnivora', 58)],
82-
index=['falcon', 'parrot', 'lion', 'monkey', 'leopard'],
83-
columns=('class', 'order', 'max_speed')
84-
)
85-
86-
grouped = df.groupby('class')
87-
grouped = df.groupby('order', axis='columns')
88-
grouped = df.groupby(['class', 'order'])
71+
# default is axis=0
72+
>>> grouped = obj.groupby(key)
73+
>>> grouped = obj.groupby(key, axis=1)
74+
>>> grouped = obj.groupby([key1, key2])
8975
9076
The mapping can be specified many different ways:
9177

0 commit comments

Comments
 (0)