Created
June 21, 2020 12:14
-
-
Save HViktorTsoi/ea181b78e86d8cdee424c36fa59dbda7 to your computer and use it in GitHub Desktop.
Cartesian product of x and y array implementation in Numpy
This file contains hidden or 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 | |
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