Time Series using 15 minute intervals using scikits.timeseries
Hi, Using scikits timeseries I can create daily and hourly time series....no prob But.... I have time series at 15 minutes intervals...this I dont know how to do... Can a timeseries array handle 15 min intervals? Do I use a minute intervals and use mask arrays for the missing minutes? Also..I can figure out how to create a array at minute intervals. So..what is best practice? Any examples? Thanks st = ts.Date('H', year=ts_start_date.year,month=ts_start_date.month,day=ts_start_date.day,hour=ts_start_hour) ed = ts.Date('H', year=ts_end_date.year,month=ts_end_date.month,day=ts_end_date.day,hour=ts_end_hour) st_beg = st.asfreq('H', relation='START') ed_end = ed.asfreq('H', relation='END')
On Jul 1, 2011, at 1:45 AM, David Montgomery wrote:
Hi,
Using scikits timeseries I can create daily and hourly time series....no prob
But....
I have time series at 15 minutes intervals...this I dont know how to do...
Can a timeseries array handle 15 min intervals? Do I use a minute intervals and use mask arrays for the missing minutes? Also..I can figure out how to create a array at minute intervals.
So..what is best practice? Any examples?
First possibility, you get the latest experimental version of scikits.timeseries on github. There's support for multiple of frequencies (like 15min). If you're not comfortable with tinkering with experimental code, you have several solutions, depending on your problem: 1. You create a minute-freq series and mask 14/15 of the data. Simple but wasteful and problematic if you have a large series. Still, the easiest solution 2. You create a hour-freq series as a 2D array: each column would correspond to the data for one quarter of this hour. That's more compact in terms of memory, but you'll have to jump through some extra hoops if you need to convert the array to another frequency (conversion routines don't really like 2D arrays...)
Awesoke... for the github version...any docs or an example for creating a 15 min array? On Fri, Jul 1, 2011 at 7:07 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
On Jul 1, 2011, at 1:45 AM, David Montgomery wrote:
Hi,
Using scikits timeseries I can create daily and hourly time series....no prob
But....
I have time series at 15 minutes intervals...this I dont know how to do...
Can a timeseries array handle 15 min intervals? Do I use a minute intervals and use mask arrays for the missing minutes? Also..I can figure out how to create a array at minute intervals.
So..what is best practice? Any examples?
First possibility, you get the latest experimental version of scikits.timeseries on github. There's support for multiple of frequencies (like 15min). If you're not comfortable with tinkering with experimental code, you have several solutions, depending on your problem: 1. You create a minute-freq series and mask 14/15 of the data. Simple but wasteful and problematic if you have a large series. Still, the easiest solution 2. You create a hour-freq series as a 2D array: each column would correspond to the data for one quarter of this hour. That's more compact in terms of memory, but you'll have to jump through some extra hoops if you need to convert the array to another frequency (conversion routines don't really like 2D arrays...)
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
On Jul 1, 2011, at 11:22 AM, David Montgomery wrote:
Awesoke...
for the github version...any docs or an example for creating a 15 min array?
Use the 'timestep' optional argument in scikits.timeseries.date_array. BTW, make sure you're using the https://github.com/pierregm/scikits.timeseries-sandbox/ repository (that's the experimental one I was telling you about). Note that support is *very* limited, as I don't really have time to work on scikits.timeseries these days. Anyhow, there'll be some major overhaul in the mid future once Mark W. new datetime dtype will be stable.
On Fri, Jul 1, 2011 at 6:11 AM, Pierre GM <pgmdevlist@gmail.com> wrote:
On Jul 1, 2011, at 11:22 AM, David Montgomery wrote:
Awesoke...
for the github version...any docs or an example for creating a 15 min array?
Use the 'timestep' optional argument in scikits.timeseries.date_array.
BTW, make sure you're using the https://github.com/pierregm/scikits.timeseries-sandbox/ repository (that's the experimental one I was telling you about). Note that support is *very* limited, as I don't really have time to work on scikits.timeseries these days. Anyhow, there'll be some major overhaul in the mid future once Mark W. new datetime dtype will be stable. _______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
depending on your data manipulation needs, you could also give pandas a shot-- generating 15-minute date ranges for example is quite simple: In [3]: DateRange('7/1/2011', '7/2/2011', offset=datetools.Minute(15)) Out[3]: <class 'pandas.core.daterange.DateRange'> offset: <15 Minutes>, tzinfo: None [2011-07-01 00:00:00, ..., 2011-07-02 00:00:00] length: 97 The date range can be used to conform a time series you loaded from some source: ts.reindex(dr, method='pad') ('pad' a.k.a. "ffill" propagates values forward into holes, optional) I've got some resampling code in the works that would help with e.g. converting 15-minute data into hourly data or that sort of thing but it's in less-than-complete form at the moment so like I said depends on what you need to do. Give me a few weeks on that bit =) best, Wes
On Jul 1, 2011, at 6:52 PM, Wes McKinney wrote:
On Fri, Jul 1, 2011 at 6:11 AM, Pierre GM <pgmdevlist@gmail.com> wrote:
On Jul 1, 2011, at 11:22 AM, David Montgomery wrote:
Awesoke...
for the github version...any docs or an example for creating a 15 min array?
Use the 'timestep' optional argument in scikits.timeseries.date_array.
BTW, make sure you're using the https://github.com/pierregm/scikits.timeseries-sandbox/ repository (that's the experimental one I was telling you about). Note that support is *very* limited, as I don't really have time to work on scikits.timeseries these days. Anyhow, there'll be some major overhaul in the mid future once Mark W. new datetime dtype will be stable. _______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
depending on your data manipulation needs, you could also give pandas a shot-- generating 15-minute date ranges for example is quite simple:
In [3]: DateRange('7/1/2011', '7/2/2011', offset=datetools.Minute(15)) Out[3]: <class 'pandas.core.daterange.DateRange'> offset: <15 Minutes>, tzinfo: None [2011-07-01 00:00:00, ..., 2011-07-02 00:00:00] length: 97
The date range can be used to conform a time series you loaded from some source:
ts.reindex(dr, method='pad')
('pad' a.k.a. "ffill" propagates values forward into holes, optional)
I've got some resampling code in the works that would help with e.g. converting 15-minute data into hourly data or that sort of thing but it's in less-than-complete form at the moment so like I said depends on what you need to do. Give me a few weeks on that bit =)
Wes, have a look on the conversion functions we have in scikits.timeseries. It's just a matter of knowing where and how to slice...
participants (3)
-
David Montgomery
-
Pierre GM
-
Wes McKinney