Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement