0

I want to combine two numpy arrays so they look like this

the input is:

a = np.arange(3).reshape(3)
b = np.arange(3).reshape(3)

and combine a and b so it looks like this:

[[0 , 0], [0 , 1],[0 , 2],[1 , 0],[1 , 1],[1 , 2],[2 , 0],[2 , 1],[2 , 2]]
jpp
  • 159,742
  • 34
  • 281
  • 339
Mark A
  • 51
  • 1
  • 3

1 Answers1

0

This is the trivial solution:

res = np.array([[i, j] for i in a for j in b])
jpp
  • 159,742
  • 34
  • 281
  • 339