Skip to content

Instantly share code, notes, and snippets.

@HViktorTsoi
Created June 21, 2020 12:14
Show Gist options
  • Save HViktorTsoi/ea181b78e86d8cdee424c36fa59dbda7 to your computer and use it in GitHub Desktop.
Save HViktorTsoi/ea181b78e86d8cdee424c36fa59dbda7 to your computer and use it in GitHub Desktop.
Cartesian product of x and y array implementation in Numpy
import numpy as np
x = np.arange(10)
y = np.arange(42)
cp = np.transpose([np.tile(x, len(y)), np.repeat(y, len(x))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment