Skip to content

Instantly share code, notes, and snippets.

@jetnew
Created June 6, 2019 11:40
Show Gist options
  • Save jetnew/26c884011a091815ad2e60f1f58cb6af to your computer and use it in GitHub Desktop.
Save jetnew/26c884011a091815ad2e60f1f58cb6af to your computer and use it in GitHub Desktop.
Rolling Windows using skimage
from skimage.util import view_as_windows
window_size = 5
timeseries = np.array([1,2,3,4,5,6,7,8,9,10])
trajectory_matrix = view_as_windows(timeseries, window_shape=window_size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment