Skip to content

Commit 331e8f9

Browse files
author
tp
committed
minor clean-up of GroupBy pipe docs
1 parent 69cd5fb commit 331e8f9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/groupby.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,8 @@ see :ref:`here <basics.pipe>`.
12191219
Combining ``.groupby`` and ``.pipe`` is often useful when you need to reuse
12201220
GroupBy objects.
12211221

1222-
For an example, imagine having a DataFrame with columns for stores, products,
1223-
revenue and sold quantity. We'd like to do a groupwise calculation of *prices*
1222+
As an example, imagine having a DataFrame with columns for stores, products,
1223+
revenue and quantity sold. We'd like to do a groupwise calculation of *prices*
12241224
(i.e. revenue/quantity) per store and per product. We could do this in a
12251225
multi-step operation, but expressing it in terms of piping can make the
12261226
code more readable. First we set the data:
@@ -1230,7 +1230,7 @@ code more readable. First we set the data:
12301230
import numpy as np
12311231
n = 1000
12321232
df = pd.DataFrame({'Store': np.random.choice(['Store_1', 'Store_2'], n),
1233-
'Product': np.random.choice(['Product_1', 'Product_2', 'Product_3'], n),
1233+
'Product': np.random.choice(['Product_1','Product_2'], n),
12341234
'Revenue': (np.random.random(n)*50+10).round(2),
12351235
'Quantity': np.random.randint(1, 10, size=n)})
12361236
df.head(2)

pandas/core/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
Notes
231231
-----
232232
See more `here
233-
<http://pandas.pydata.org/pandas-docs/stable/groupby.html#pipe>`_
233+
<http://pandas.pydata.org/pandas-docs/stable/groupby.html#piping-function-calls>`_
234234
235235
Examples
236236
--------

0 commit comments

Comments
 (0)