Resample time series in pandas to a weekly interval

点点圈 提交于 2019-11-28 09:17:13
Andy Hayden

You can pass anchored offsets to resample, among other options they cover this case.

For example the weekly frequency from Monday:

ts.resample('W-MON')

You will be much safer with resampling based on days and then slicing every 7th day, e.g:

ts.resample('D').interpolate()[::7]

See the underlying problem with other approaches in this open pandas issue on github:

https://github.com/pandas-dev/pandas/issues/16381

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!