Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import time
- import pandas as pd
- import numpy as np
- periods = 40 * 365 * 24
- tidx = pd.date_range("2016-07-01", periods=periods, freq="H")
- ts = pd.Series(data=data, index=tidx, name="HelloTimeSeries")
- b = time()
- x = ts.array.to_numpy()
- n = x.shape[0]
- d = dict()
- for i in range(0, n, 24):
- d[ts.index[i].date()] = x[max(24 * (i - 15), 0) : min(24 * (i + 15), n)]
- e = time()
- print(e - b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement