[SciPy-user] assignment of hours of day in time series

Tim Michelsen timmichelsen@gmx-topmail...
Sun Jan 6 18:03:53 CST 2008


Hello,
my first post was sent nearly 2 weeks ago and may have gotten buried 
between the years. I therefore Cc it to the time series developers 
because they may know something on this.

> I'd start with the Python built-in datetime module and see if that helps.
As I see from the example (http://docs.python.org/lib/node85.html) the 
datetime objects are a basis for date and time formatting and 
calculations. I think they are being used internally by the module. But 
I am talking of a simple solution to adjust the input (read: start time 
of my time series) and the reporting.
For a easier understanding I have put some random data below. The first 
table. Shows my input data which I also described in my previous email. 
I think may data sets from sensors will be in a format like mine.
The last table is what I would like to get in my report.

How would you as experienced scipy/time series user implement the code 
to get my desired output?
I read the documentation with pydoc and didn't find any parameter to set 
24:00 instead of 0:00 hrs.

Thanks for your help,
Timmie

Example tables:

table 1: 		
original data		
date	hour_of_day	value
1-Feb-2004	1	247
1-Feb-2004	2	889
1-Feb-2004	3	914
1-Feb-2004	4	292
1-Feb-2004	5	183
1-Feb-2004	6	251
1-Feb-2004	7	953
1-Feb-2004	8	156
1-Feb-2004	9	991
1-Feb-2004	10	557
1-Feb-2004	11	581
1-Feb-2004	12	354
1-Feb-2004	13	485
1-Feb-2004	14	655
1-Feb-2004	15	862
1-Feb-2004	16	399
1-Feb-2004	17	598
1-Feb-2004	18	744
1-Feb-2004	19	445
1-Feb-2004	20	374
1-Feb-2004	21	168
1-Feb-2004	22	995
1-Feb-2004	23	943
1-Feb-2004	24	326
		
table 2: 		
report with start hour set to hour 1		
date	hour_of_day	value
1-Feb-2004	1:00	247
1-Feb-2004	2:00	889
1-Feb-2004	3:00	914
1-Feb-2004	4:00	292
1-Feb-2004	5:00	183
1-Feb-2004	6:00	251
1-Feb-2004	7:00	953
1-Feb-2004	8:00	156
1-Feb-2004	9:00	991
1-Feb-2004	10:00	557
1-Feb-2004	11:00	581
1-Feb-2004	12:00	354
1-Feb-2004	13:00	485
1-Feb-2004	14:00	655
1-Feb-2004	15:00	862
1-Feb-2004	16:00	399
1-Feb-2004	17:00	598
1-Feb-2004	18:00	744
1-Feb-2004	19:00	445
1-Feb-2004	20:00	374
1-Feb-2004	21:00	168
1-Feb-2004	22:00	995
1-Feb-2004	23:00	943
2-Feb-2004	0:00	326
		
table 3: 		
report with start hour set to hour 1		
date	hour_of_day	value
1-Feb-2004	0:00	247
1-Feb-2004	1:00	889
1-Feb-2004	2:00	914
1-Feb-2004	3:00	292
1-Feb-2004	4:00	183
1-Feb-2004	5:00	251
1-Feb-2004	6:00	953
1-Feb-2004	7:00	156
1-Feb-2004	8:00	991
1-Feb-2004	9:00	557
1-Feb-2004	10:00	581
1-Feb-2004	11:00	354
1-Feb-2004	12:00	485
1-Feb-2004	13:00	655
1-Feb-2004	14:00	862
1-Feb-2004	15:00	399
1-Feb-2004	16:00	598
1-Feb-2004	17:00	744
1-Feb-2004	18:00	445
1-Feb-2004	19:00	374
1-Feb-2004	20:00	168
1-Feb-2004	21:00	995
1-Feb-2004	22:00	943
1-Feb-2004	23:00	326
		
table 4: 		
desired report output		
date	hour_of_day	value
1-Feb-2004	1:00	247
1-Feb-2004	2:00	889
1-Feb-2004	3:00	914
1-Feb-2004	4:00	292
1-Feb-2004	5:00	183
1-Feb-2004	6:00	251
1-Feb-2004	7:00	953
1-Feb-2004	8:00	156
1-Feb-2004	9:00	991
1-Feb-2004	10:00	557
1-Feb-2004	11:00	581
1-Feb-2004	12:00	354
1-Feb-2004	13:00	485
1-Feb-2004	14:00	655
1-Feb-2004	15:00	862
1-Feb-2004	16:00	399
1-Feb-2004	17:00	598
1-Feb-2004	18:00	744
1-Feb-2004	19:00	445
1-Feb-2004	20:00	374
1-Feb-2004	21:00	168
1-Feb-2004	22:00	995
1-Feb-2004	23:00	943
1-Feb-2004	24:00	326



More information about the SciPy-user mailing list