pandas / 1.4.0 / reference / api / pandas.core.resample.resampler.transform.html /

pandas.core.resample.Resampler.transform

Resampler. transform ( arg, *args, **kwargs ) [source]

Call function producing a like-indexed Series on each group and return a Series with the transformed values.

Parameters
arg :function

To apply to each group. Should return a Series with the same index.

Returns
transformed :Series

Examples

>>> s = pd.Series([1, 2],
...               index=pd.date_range('20180101',
...                                   periods=2,
...                                   freq='1h'))
>>> s
2018-01-01 00:00:00    1
2018-01-01 01:00:00    2
Freq: H, dtype: int64
>>> resampled = s.resample('15min')
>>> resampled.transform(lambda x: (x - x.mean()) / x.std())
2018-01-01 00:00:00   NaN
2018-01-01 01:00:00   NaN
Freq: H, dtype: float64

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.4.0/reference/api/pandas.core.resample.Resampler.transform.html