@@ -4545,16 +4545,16 @@ def pipe(self, func, *args, **kwargs):
45454545
45464546 Parameters
45474547 ----------
4548- func : function, string , list of functions and/or strings or dict
4548+ func : function, str , list or dict
45494549 Function to use for aggregating the data. If a function, must either
45504550 work when passed a %(klass)s or when passed to %(klass)s.apply.
45514551
45524552 Accepted combinations are:
45534553
4554- - string function name
45554554 - function
4556- - list of functions and/or function names
4557- - dict of axis labels -> functions, function names or list of such
4555+ - string function name
4556+ - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
4557+ - dict of axis labels -> functions, function names or list of such.
45584558 %(axis)s
45594559 *args
45604560 Positional arguments to pass to `func`.
@@ -4563,7 +4563,11 @@ def pipe(self, func, *args, **kwargs):
45634563
45644564 Returns
45654565 -------
4566- pandas.%(klass)s
4566+ DataFrame, Series or scalar
4567+ if DataFrame.agg is called with a single function, returns a Series
4568+ if DataFrame.agg is called with several functions, returns a DataFrame
4569+ if Series.agg is called with single function, returns a scalar
4570+ if Series.agg is called with several functions, returns a Series
45674571
45684572 Notes
45694573 -----
@@ -4580,15 +4584,15 @@ def pipe(self, func, *args, **kwargs):
45804584
45814585 Parameters
45824586 ----------
4583- func : function, string , list of functions and/or strings or dict
4587+ func : function, str , list or dict
45844588 Function to use for transforming the data. If a function, must either
45854589 work when passed a %(klass)s or when passed to %(klass)s.apply.
45864590
45874591 Accepted combinations are:
45884592
4589- - string function name
45904593 - function
4591- - list of functions and/or function names
4594+ - string function name
4595+ - list of functions and/or function names, e.g. ``[np.exp. 'sqrt']``
45924596 - dict of axis labels -> functions, function names or list of such.
45934597 %(axis)s
45944598 *args
@@ -4598,31 +4602,41 @@ def pipe(self, func, *args, **kwargs):
45984602
45994603 Returns
46004604 -------
4601- pandas. %(klass)s
4605+ %(klass)s
46024606 A %(klass)s that must have the same length as self.
46034607
46044608 Raises
46054609 ------
4606- ValueError : if the returned %(klass)s has a different length than self.
4610+ ValueError : If the returned %(klass)s has a different length than self.
46074611
46084612 See Also
46094613 --------
4610- pandas. %(klass)s.agg : only perform aggregating type operations
4611- pandas. %(klass)s.apply : Invoke function on a Series
4614+ %(klass)s.agg : Only perform aggregating type operations.
4615+ %(klass)s.apply : Invoke function on a %(klass)s.
46124616
46134617 Examples
46144618 --------
46154619 >>> df = pd.DataFrame({'A': range(3), 'B': range(1, 4)})
4620+ >>> df
4621+ A B
4622+ 0 0 1
4623+ 1 1 2
4624+ 2 2 3
46164625 >>> df.transform(lambda x: x + 1)
46174626 A B
46184627 0 1 2
46194628 1 2 3
46204629 2 3 4
46214630
4622- Even though the resulting %(klass)s must have the length as the input
4623- %(klass)s, it is possible to provide several input functions:
4631+ Even though the resulting %(klass)s must have the same length as the
4632+ input %(klass)s, it is possible to provide several input functions:
46244633
46254634 >>> s = pd.Series(range(3))
4635+ >>> s
4636+ 0 0
4637+ 1 1
4638+ 2 2
4639+ dtype: int64
46264640 >>> s.transform([np.sqrt, np.exp])
46274641 sqrt exp
46284642 0 0.000000 1.000000
0 commit comments