Python Forum

Full Version: Convert weekly sequences to date and time.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have an optimization model that returns long time series of numbers. Each week has 36 values. Each value represents a different number of hours. The numbers are stored in an NymPy array. Then I have a corresponding array of 36 values that describes how many hours each sequence should have so that you get a total of 168 values/hours each week.
We know the start time. The first 36 sequences represent values in week 1 2020 starting on December 30, 2019.
Is there an easy way in NumPy to give timestamp to each value without using loop? In other words, enter an array of all values and specify an array of 36 numbers that describe how many hours each sequence should have?

Example week 1 2020. TimeStamp is what I am looking for. There is many thousand values, and SeqHour should be "reused" for every week.

SeqHour Values TimeStamp
3 25 30.12.2019 00
3 20 30.12.2019 03
12 20 30.12.2019 18
5 2 31.12.2019 14
1 8 01.01.2020 11
3 5 01.01.2020 11
3 30 01.01.2020 14
12 9 02.01.2020 05
5 28 03.01.2020 01
1 0 03.01.2020 22
3 24 03.01.2020 22
3 1 04.01.2020 01
12 13 04.01.2020 16
5 7 05.01.2020 12
1 30 06.01.2020 09
3 25 06.01.2020 09
3 30 06.01.2020 12
12 31 07.01.2020 03
5 13 07.01.2020 23
1 11 08.01.2020 20
3 11 08.01.2020 20
3 2 08.01.2020 23
12 5 09.01.2020 14
5 26 10.01.2020 10
1 21 11.01.2020 07
3 25 11.01.2020 07
5 9 11.01.2020 12
10 4 12.01.2020 03
5 22 12.01.2020 23
1 19 13.01.2020 20
3 4 13.01.2020 20
3 0 13.01.2020 23
2 11 14.01.2020 04
15 11 15.01.2020 00
1 28 15.01.2020 21
...And so on...