@@ -4545,17 +4545,16 @@ def pipe(self, func, *args, **kwargs):
4545
4545
4546
4546
Parameters
4547
4547
----------
4548
- func : function, string, dictionary, or list of string/functions
4548
+ func : function, string, list of string/functions or dictionary
4549
4549
Function to use for aggregating the data. If a function, must either
4550
- work when passed a %(klass)s or when passed to %(klass)s.apply. For
4551
- a DataFrame, can pass a dict, if the keys are DataFrame column names.
4550
+ work when passed a %(klass)s or when passed to %(klass)s.apply.
4552
4551
4553
4552
Accepted combinations are:
4554
4553
4555
- - string function name.
4556
- - function.
4557
- - list of functions.
4558
- - dict of column names -> functions ( or list of functions).
4554
+ - string function name
4555
+ - function
4556
+ - list of functions and/or function names
4557
+ - dict of axis labels -> functions, function names or list of such
4559
4558
%(axis)s
4560
4559
*args
4561
4560
Positional arguments to pass to `func`.
@@ -4581,43 +4580,32 @@ def pipe(self, func, *args, **kwargs):
4581
4580
4582
4581
Parameters
4583
4582
----------
4584
- func : callable, string, dictionary, or list of string/callables
4585
- To apply to column
4583
+ func : function, string, list of string/functions or dictionary
4584
+ Function to use for transforming the data. If a function, must either
4585
+ work when passed a %(klass)s or when passed to %(klass)s.apply.
4586
+ The function (or each function in a list/dict) must return an
4587
+ object with the same length for the provided axis as the
4588
+ calling %(klass)s.
4586
4589
4587
- Accepted Combinations are:
4590
+ Accepted combinations are:
4588
4591
4589
4592
- string function name
4590
4593
- function
4591
- - list of functions
4592
- - dict of column names -> functions (or list of functions)
4594
+ - list of functions and/or function names
4595
+ - dict of axis labels -> functions, function names or list of such
4596
+ %(axis)s
4597
+ *args
4598
+ Positional arguments to pass to `func`.
4599
+ **kwargs
4600
+ Keyword arguments to pass to `func`.
4593
4601
4594
4602
Returns
4595
4603
-------
4596
4604
transformed : %(klass)s
4597
4605
4598
- Examples
4599
- --------
4600
- >>> df = pd.DataFrame(np.random.randn(10, 3), columns=['A', 'B', 'C'],
4601
- ... index=pd.date_range('1/1/2000', periods=10))
4602
- df.iloc[3:7] = np.nan
4603
-
4604
- >>> df.transform(lambda x: (x - x.mean()) / x.std())
4605
- A B C
4606
- 2000-01-01 0.579457 1.236184 0.123424
4607
- 2000-01-02 0.370357 -0.605875 -1.231325
4608
- 2000-01-03 1.455756 -0.277446 0.288967
4609
- 2000-01-04 NaN NaN NaN
4610
- 2000-01-05 NaN NaN NaN
4611
- 2000-01-06 NaN NaN NaN
4612
- 2000-01-07 NaN NaN NaN
4613
- 2000-01-08 -0.498658 1.274522 1.642524
4614
- 2000-01-09 -0.540524 -1.012676 -0.828968
4615
- 2000-01-10 -1.366388 -0.614710 0.005378
4616
-
4617
- See also
4618
- --------
4619
- pandas.%(klass)s.aggregate
4620
- pandas.%(klass)s.apply
4606
+ Raises
4607
+ ------
4608
+ ValueError: if the returned object has a different length than self.
4621
4609
""" )
4622
4610
4623
4611
# ----------------------------------------------------------------------
@@ -9401,7 +9389,7 @@ def ewm(self, com=None, span=None, halflife=None, alpha=None,
9401
9389
9402
9390
cls .ewm = ewm
9403
9391
9404
- @Appender (_shared_docs ['transform' ] % _shared_doc_kwargs )
9392
+ @Appender (_shared_docs ['transform' ] % dict ( axis = "" , ** _shared_doc_kwargs ) )
9405
9393
def transform (self , func , * args , ** kwargs ):
9406
9394
result = self .agg (func , * args , ** kwargs )
9407
9395
if is_scalar (result ) or len (result ) != len (self ):
0 commit comments