@@ -4583,9 +4583,6 @@ def pipe(self, func, *args, **kwargs):
45834583 func : function, string, list of string/functions or dictionary
45844584 Function to use for transforming the data. If a function, must either
45854585 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.
45894586
45904587 Accepted combinations are:
45914588
@@ -4606,6 +4603,45 @@ def pipe(self, func, *args, **kwargs):
46064603 Raises
46074604 ------
46084605 ValueError: if the returned %(klass)s has a different length than self.
4606+
4607+ Examples
4608+ --------
4609+ >>> df = pd.DataFrame(np.random.randn(10, 2), columns=['A', 'B'],
4610+ ... index=pd.date_range('1/1/2000', periods=10))
4611+ >>> df.iloc[3:7] = np.nan
4612+
4613+ >>> df.transform(lambda x: (x - x.mean()) / x.std())
4614+ A B
4615+ 2000-01-01 0.579457 1.236184
4616+ 2000-01-02 0.370357 -0.605875
4617+ 2000-01-03 1.455756 -0.277446
4618+ 2000-01-04 NaN NaN
4619+ 2000-01-05 NaN NaN
4620+ 2000-01-06 NaN NaN
4621+ 2000-01-07 NaN NaN
4622+ 2000-01-08 -0.498658 1.274522
4623+ 2000-01-09 -0.540524 -1.012676
4624+ 2000-01-10 -1.366388 -0.614710
4625+
4626+ It is only required for the axis specified in the ``axis`` parameter
4627+ to have the same length for output and for self. The other axis may have a
4628+ different length:
4629+
4630+ >>> s = pd.Series(range(5))
4631+ >>> s.transform([np.sqrt, np.exp])
4632+ sqrt exp
4633+ 0 0.000000 1.000000
4634+ 1 1.000000 2.718282
4635+ 2 1.414214 7.389056
4636+ 3 1.732051 20.085537
4637+ 4 2.000000 54.598150
4638+
4639+ See also
4640+ --------
4641+ pandas.DataFrame.aggregate
4642+ pandas.DataFrame.apply
4643+ pandas.Series.aggregate
4644+ pandas.Series.apply
46094645 """ )
46104646
46114647 # ----------------------------------------------------------------------
0 commit comments