码迷,mamicode.com
首页 > 其他好文 > 详细

pandas中没有了'rolling_mean' 'rolling_std'

时间:2020-02-01 16:04:07      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:lin   and   time   err   taf   ati   ken   erro   hal   

rolmean = pd.rolling_mean(timeseries, window=12)

rolstd = pd.rolling_std(timeseries, window=12)

expwighted_avg = pd.ewma(ts_log, halflife=12)

会有报错

AttributeError: module ‘pandas‘ has no attribute ‘rolling_mean‘

AttributeError: module ‘pandas‘ has no attribute ‘rolling_std‘

AttributeError: module ‘pandas‘ has no attribute ‘ewma‘

这是因为pandas版本跟新了,应该改为

rolmean = timeseries.rolling(12).mean()
rolstd = timeseries.rolling(12).std()

expwighted_avg = pd.DataFrame.ewm(ts_log, halflife=12).mean()

pandas中没有了'rolling_mean' 'rolling_std'

标签:lin   and   time   err   taf   ati   ken   erro   hal   

原文地址:https://www.cnblogs.com/xingnie/p/12248732.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!