EDIT: Please note that the question has 4 NumPy arrays, and thus might be much more difficult to merge, which is why I asked the queston in first place.
I want to generate all possible combinations of 4 NumPy arrays, but cannot find a suitable Pythonic way to do this. For example these are the arrays:
w = np.array([-0.75, -0.25, 0, 0.25, 0.75])
x = np.array([-0.75, -0.25, 0, 0.25, 0.75])
y = np.array([-0.75, -0.25, 0, 0.25, 0.75])
z = np.array([-0.75, -0.25, 0, 0.25, 0.75])
Now I want to generate a (625,4) dimensional array with all possible combinations of the elements taken from the 4 arrays i.e elements from x
will populate 1st column, y
2nd column and so on but all possible combinations should be made, something like:
000
001
010
011
100
101
110
111
I could not figure out how to do this with np.meshgrid
as there are too many dimensions to visualise.