Created
June 2, 2020 10:15
-
-
Save ajdapretnar/72757d1263dd1920660b5aa4c167a8bb to your computer and use it in GitHub Desktop.
Aligment of timeseries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from copy import deepcopy | |
n = 100 | |
out_data = deepcopy(in_data) | |
out_data.X[out_data.X < n] = 0 | |
ar = np.argwhere(out_data.X) | |
cols, shifts = np.unique(ar[:, 1], return_counts=True) | |
out_data.X = np.array([np.roll(out_data.X[:, col], shift) for col, shift in zip(cols, shifts)]).T | |
out_data.X[out_data.X==0]= np.nan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment