File tree 1 file changed +7
-3
lines changed 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1301,11 +1301,15 @@ Piping can also be expressive when you want to deliver a grouped object to some
1301
1301
arbitrary function, for example:
1302
1302
1303
1303
.. code-block :: python
1304
+ def mean (groupby ):
1305
+ return (groupby.mean())
1304
1306
1305
- df.groupby([' Store' , ' Product' ]).pipe(report_func )
1307
+ df.groupby([' Store' , ' Product' ]).pipe(mean )
1306
1308
1307
- where ``report_func `` takes a GroupBy object and creates a report
1308
- from that.
1309
+ where ``mean `` takes a GroupBy object and finds the mean of the Revenue and Quantity
1310
+ columns repectively for each Store-Product combination. The ``mean `` function can
1311
+ be any function that takes in a GroupBy object; the ``.pipe `` will pass the GroupBy
1312
+ object as a parameter into the function you specify.
1309
1313
1310
1314
Examples
1311
1315
--------
You can’t perform that action at this time.
0 commit comments