SHARE
TWEET

Untitled

a guest Jun 18th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from time import time
  2. import pandas as pd
  3. import numpy as np
  4.  
  5. periods = 40 * 365 * 24
  6. tidx = pd.date_range("2016-07-01", periods=periods, freq="H")
  7.  
  8. ts = pd.Series(data=data, index=tidx, name="HelloTimeSeries")
  9.  
  10. b = time()
  11.  
  12. x = ts.array.to_numpy()
  13. n = x.shape[0]
  14. d = dict()
  15.  
  16. for i in range(0, n, 24):
  17.     d[ts.index[i].date()] = x[max(24 * (i - 15), 0) : min(24 * (i + 15), n)]
  18.  
  19. e = time()
  20. print(e - b)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top