将大 pandas 中的时间序列重新采样到每周间隔 [英] Resample time series in pandas to a weekly interval

查看:60
本文介绍了将大 pandas 中的时间序列重新采样到每周间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将大熊猫中的时间序列重新采样为每周从任意一天开始的每周频率?我看到有一个可选的关键字库,但是它只适用于少于一天的时间间隔.

How do I resample a time series in pandas to a weekly frequency where the weeks start on an arbitrary day? I see that there's an optional keyword base but it only works for intervals shorter than a day.

推荐答案

您可以传递锚定的偏移量 resample ,它们涵盖了这种情况.

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')

这篇关于将大 pandas 中的时间序列重新采样到每周间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆