Skip to content

Instantly share code, notes, and snippets.

@schlameel
Last active July 24, 2020 18:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schlameel/2ee338c35c72bedcdda58dcb121f2786 to your computer and use it in GitHub Desktop.
Save schlameel/2ee338c35c72bedcdda58dcb121f2786 to your computer and use it in GitHub Desktop.
Interleave data using numpy
import numpy as np
arr1 = np.zeros(100)
arr2 = np.ones(100)
arr_tuple = (arr1, arr2)
interleaved = np.vstack(arr_tuple).reshape((-1,), order='F')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment