Hi - I am attempting to write a script that follows this workflow:
1 - begin a loop on a certain starting datetime (e.g. Oct 1, 2021 11:00 AM). I'll refer to this as row n. Obtain value from col1[row n].
2 - go to next row, n+1. set col2 = col1 [n+1] - col1[n].
3 - go to next row, n+2, set col2 = col1 [n+2] - col1[n]
4 - go to next row, n+3, set col2 = col1[ n+3] - col1[n]. Continue to loop to through each subsequent row until datetime[n+k] = datetime[n] + 7 days. (Note that k will vary depending on the time increment between rows as the loop proceeds; e.g. the time increases from one row to the next by 5 mins, 15 mins, 1 hr, etc, depending on the row in question.)
5 - Repeat steps 1 to 4 for each new week of data by using a new "start date" obtained in step 4. Continue looping through another 7 days of data.
6 - Repeat step 5 until data table runs out of rows.
The goal is to do computations on col1 data that compare a week's worth of rows to the first row of that week, and then to repeat this over and over for each subsequent week (week 2, week 3, week 4, etc) until all rows have been processed. : )