简体   繁体   English

在时间序列中查找时间段

[英]Find period in a Time Series

I have the following Time Series:我有以下时间序列:

在此处输入图片说明

From the plot I can notice that data are periodic, since the peaks(let's call them valley since I am talking about the one that goes down) have more or less the same distances.从图中我可以注意到数据是周期性的,因为峰值(我们称它们为谷,因为我说的是下降的那个)具有或多或少相同的距离。 Is there a way to find what is the period, expressed as the number of points between each peak.有没有办法找到什么是周期,表示为每个峰值之间的点数。 I don't need a very precise number, an estimate would be enough.我不需要一个非常精确的数字,一个估计就足够了。

You can try pandas.infer_freq like this:您可以像这样尝试pandas.infer_freq

>>> import pandas as pd
>>> ts_data = pd.read_csv("ts_data.csv")
>>> pd.infer_freq(ts_data.index.values)
4

Alternatively I would suggest using findfrequency of the R forecast package.或者,我建议使用 R forecast包的findfrequency

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM