pandas.core.resample.Resampler.transform#
- Resampler.transform(arg, *args, **kwargs)[源代码]#
调用在每个组上生成相似索引系列的函数,并返回具有转换后的值的系列。
- 参数
- arg功能
适用于每一组。应返回具有相同索引的Series。
- 退货
- transformed系列
示例
>>> 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