I'm just looking for some help in deciding a method that would be most efficient. I have one dataset with particular dates, there is no regular timestep. For each of these dates I want to create a row with values ranging from 10 days before to 3 days after the date. The data I need is in 2 columns, dates in one, values in the other.
What sprung to mind was to use a loop to compare the dates and extract the values I need. I am thinking there might be a better way, using numpy\pandas or maybe something else? I feel like my idea is a fairly convoluted way of going about things.
EDIT: So the data in would be like this.
Date Values
2014-02-09 38.351
2014-02-10 38.281
2014-02-11 38.146
2014-02-12 38.205
2014-02-13 38.428
2014-02-14 38.449
2014-02-15 38.540
2014-02-16 38.586
2014-02-17 38.489
2014-02-18 38.552
2014-02-19 38.580
2014-02-20 38.447
2014-02-21 38.336
2014-02-22 38.284
2014-02-23 38.183
2014-02-24 38.143
2014-02-25 38.146
2014-02-26 38.221
2014-02-27 38.182
2014-02-28 38.170
And a sample output for one row would be in the form:
t-10 t-9 t-8 t-7 t-6 t-5 t-4 t-3 \
Date
2014-02-19 37.728 37.753 37.652 37.549 37.474 37.407 37.344 37.278
t-2 t-1 t t+1 t+2 t+3
Date
2014-02-19 37.221 37.18 37.125 37.138 37.414 37.394
Where the values from t-10 to t+3 are extracted when t = 2014-02-19. I need to do this for several different dates.
Edit: I have these specific dates I need to use. The values t-10 to t+3 with t as each of the below dates for example. This is what lead me to consider using a loop. But it seems like a messy way of doing things.
Date
0 2014-11-22
1 2014-12-28
2 2015-01-02
3 2015-02-04
4 2015-02-16
5 2015-02-28
6 2015-03-12
7 2015-03-24
8 2015-04-05
9 2015-04-15
10 2015-04-17
11 2015-04-20
12 2015-11-07
13 2015-11-10
14 2015-11-19
15 2015-11-22
16 2015-11-29
17 2015-12-01
18 2015-12-04
19 2015-12-11