Question: unequally spaced timeseries
See original GitHub issueFirst, big thanks for a nice library! Very useful!
I am trying to follow your Quick Start for SeasonalAD, but I am encountering a problem. My timeseries seem be to unequally spaced (e.g. 09:05, 09:15, 9:30, 9:55). Hence the SeasonalAD complains:
RuntimeError: Series does not follow any known frequency (e.g. second, minute, hour, day, week, month, year, etc.
How to overcome this?
I have tried rounding my series to 15min, removing duplicates and resampling.
s_train.index = s_train.index.round('15min')
s_train = s_train[~s_train.index.duplicated()]
s_train = s_train.asfreq('15min')
Obviously nothing worked. Any ideas how to solve this? I wish to retain as much granularity as possible.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Is there any gold standard for modeling irregularly spaced ...
If the observations of a stochastic process are irregularly spaced the most natural way to model the observations is as discrete time ......
Read more >uneven spaced time series - MathOverflow
The times series are uneven spaced, that is tk−tk−1 is not independent of k. I don't know of any textbook, algorithm or paper...
Read more >Unevenly spaced time series - Wikipedia
spaced time series is a sequence of observation time and value pairs (t n, X n ) in which the spacing of observation...
Read more >On Unequally Spaced Time Points in Time Series
This article discusses the sampling of stationary discrete-time stochastic processes at fixed but unequally spaced time points. The pattern of the sampling ...
Read more >Unevenly Spaced Data | ideo.com
These event-triggered sensors give rise to unevenly-spaced time series. Many analysts will immediately convert unevenly-spaced data to evenly-spaced time ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try s_train.resample(‘15min’).ffill() if adtk.data doesn’t have resample
@ajdapretnar Seasonal decomposition in ADTK requires the input follows equally spaced time series, as you noticed. Therefore, the time series should be resampled with a constant frequency, for example 15 min.
If you got a ValueError regarding NaN values, the reason is that your resampling may introduce NaN value to the new time series (in your example, 9:45 will have NaN value). Currently, SeasonAD does not support time series with NaN, unless the NaN values are on the starting or ending part of the time series and they will be ignored.
In the
adtk.data
module, we offer a resample function, which resamples a time series with user-given space. The resampling is based on linear interpolation. You may try it like the follows.If you want to fill NaN with forward or backward filling instead of interpolation, I believe you can also use the
fillna
method of Pandas.