Python Forum
Convert weekly sequences to date and time.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert weekly sequences to date and time.
#1
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...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 104 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Date Time Series Help...Please spra8560 2 312 Feb-01-2024, 01:38 PM
Last Post: spra8560
  Python date format changes to date & time 1418 4 512 Jan-20-2024, 04:45 AM
Last Post: 1418
  Downloading time zone aware files, getting wrong files(by date))s tester_V 9 956 Jul-23-2023, 08:32 AM
Last Post: deanhystad
  Formatting a date time string read from a csv file DosAtPython 5 1,160 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  Review my code: convert a HTTP date header to a datetime object stevendaprano 1 1,901 Dec-17-2022, 12:24 AM
Last Post: snippsat
  Resample from monthly to weekly works, but not vice versa JaneTan 0 535 Dec-14-2022, 12:58 AM
Last Post: JaneTan
  detect equal sequences in list flash77 17 2,682 Oct-28-2022, 06:38 AM
Last Post: flash77
  Convert Date to another format lonesoac0 2 1,631 Mar-17-2022, 11:26 AM
Last Post: DeaD_EyE
  Wait til a date and time KatManDEW 2 1,390 Mar-11-2022, 08:05 PM
Last Post: KatManDEW

Forum Jump:

User Panel Messages

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