I am trying to map 2 numpy arrays as [x, y] similar to what zip does for lists and tuples.
I have 2 numpy arrays as follows:
arr1 = [1, 2, 3, 4]
arr2 = [5, 6, 7, 8]
I am looking for an output as np.array([[[1, 5], [2, 6], [3, 7], [4, 8]]])
I tried this but it maps every value and not with same indices. I can add more if conditions here but is there any other way to do so without adding any more if conditions.
res = [arr1, arr2] for a1 in arr1 for a2 in arr2]