Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time series manipulation
#1
Hi!
We have an optimization model that gives us forecasts of electricity consumption in the future. Because of calculation time we do not use hourly resolution.
Each week is divided into 34 sequences where each sequence represents a certain number of hours. (sum of all 34 sequences will be 168 hours).
The results from the model go 10 years ahead in time. We get over 500 weeks with results, each with 34 sequences and values. Assuming that we always start on Monday of this week. How can I easily create a vector with date and time?
I guess we can make a loop and calculate time based on the difference in hours from the start time. But I have a feeling that this can do in a nicer way in Python with built-in features in Numpy or Pandas?

What will be the best way to do this?

Example. (we want to establish values ​​as in column 3 here)
(The second column contains the number of hours in each of the 34 sequences)

NP index Hours What we are looking for
0 6 2020-03-30 00:00
1 1 2020-03-30 06:00
2 6 2020-03-30 07:00
3 4 2020-03-30 13:00
4 3 2020-03-30 17:00
5 4 2020-03-30 20:00
6 6 2020-03-31 00:00
7 1 2020-03-31 06:00
8 6 2020-03-31 07:00
9 4 2020-03-31 13:00
10 3 2020-03-31 17:00
11 4 2020-03-31 20:00
12 6 2020-04-01 00:00
13 1 2020-04-01 06:00
14 6 2020-04-01 07:00
15 4 2020-04-01 13:00
16 3 2020-04-01 17:00
17 4 2020-04-01 20:00
18 6 2020-04-02 00:00
19 1 2020-04-02 06:00
20 6 2020-04-02 07:00
21 4 2020-04-02 13:00
22 3 2020-04-02 17:00
23 4 2020-04-02 20:00
24 6 2020-04-03 00:00
25 1 2020-04-03 06:00
26 6 2020-04-03 07:00
27 4 2020-04-03 13:00
28 3 2020-04-03 17:00
29 4 2020-04-03 20:00
30 7 2020-04-04 00:00
31 17 2020-04-04 07:00
32 7 2020-04-05 00:00
33 17 2020-04-05 07:00
0 6 2020-04-06 00:00
1 1 2020-04-06 06:00
2 6 2020-04-06 07:00
3 4 2020-04-06 13:00
4 3 2020-04-06 17:00
5 4 2020-04-06 20:00
6 6 2020-04-07 00:00
7 1 2020-04-07 06:00
8 6 2020-04-07 07:00
9 4 2020-04-07 13:00
10 3 2020-04-07 17:00
11 4 2020-04-07 20:00
12 6 2020-04-08 00:00
13 1 2020-04-08 06:00
14 6 2020-04-08 07:00
15 4 2020-04-08 13:00
16 3 2020-04-08 17:00
17 4 2020-04-08 20:00
18 6 2020-04-09 00:00
19 1 2020-04-09 06:00
20 6 2020-04-09 07:00
21 4 2020-04-09 13:00
22 3 2020-04-09 17:00
23 4 2020-04-09 20:00
24 6 2020-04-10 00:00
25 1 2020-04-10 06:00
26 6 2020-04-10 07:00
27 4 2020-04-10 13:00
28 3 2020-04-10 17:00
29 4 2020-04-10 20:00
30 7 2020-04-11 00:00
31 17 2020-04-11 07:00
32 7 2020-04-12 00:00
33 17 2020-04-12 07:00

And so on....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Date Time Series Help...Please spra8560 2 352 Feb-01-2024, 01:38 PM
Last Post: spra8560
  Print names in x-axis of a time-series values hobbyist 4 1,218 Apr-22-2023, 09:29 PM
Last Post: deanhystad
  Time series JasminQuinn 0 1,019 Apr-22-2022, 10:33 PM
Last Post: JasminQuinn
  How to read rainfall time series and insert missing data points MadsM 4 2,165 Jan-06-2022, 10:39 AM
Last Post: amdi40
  Plotting A Time Series With Shaded Recession Bars adamszymanski 1 3,157 Jan-24-2021, 09:08 PM
Last Post: nealc
  Getting the hourly average of a time series dataset Raskou07 10 12,534 Dec-15-2020, 12:51 PM
Last Post: palladium
  Tableau Time Series Prediction using Python Integration tobimarsh43 0 1,907 Jul-24-2020, 10:38 AM
Last Post: tobimarsh43
  Bode plot from time series experiment data discus 4 7,328 Jun-20-2020, 07:46 AM
Last Post: discus
  Convert quarterly time series to monthly time series donnertrud 1 5,166 May-22-2020, 10:16 AM
Last Post: pyzyx3qwerty
  Multiply Two Time Series: Not Working brandonfoo 0 1,997 Feb-27-2019, 05:15 AM
Last Post: brandonfoo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020