python - Efficient creation of a new time series from two irregular time series with Pandas -


i have 2 time irregular series, , b, want create new one. resulting series should have same index values should based on rolling sum on time window of values in b, in relation indices in a.

for example: a

2011-01-27 10:21:43    0 2011-01-27 10:43:29    0 2011-01-27 19:39:39    0 2011-01-27 19:55:55    0 2011-01-27 19:58:25    0 2011-01-28 15:31:58    0 2011-01-28 16:27:13    0 

b

2011-01-27 10:20:29    0 2011-01-27 18:31:23    1 2011-01-27 18:45:25    1 2011-01-27 18:57:22    1 2011-01-27 19:15:25    0 

desired result using 1 hour window:

2011-01-27 10:21:43    0 2011-01-27 10:43:29    0 2011-01-27 19:39:39    2 2011-01-27 19:56:55    1 2011-01-27 19:58:25    1 2011-01-28 15:31:58    0 2011-01-28 16:27:13    0 

currently looping through indices of , performing sum on b using b[t-hour():t].sum(). seems inefficient. suggestions?


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -