I am trying to replicate the behaviour of zip(a, b)
in order to be able to loop simultaneously along two NumPy
arrays. In particular, I have two arrays a
and b
:
a.shape=(n,m)
b.shape=(m,)
I would like to get for every loop a column of a
and an element of b
.
So far, I have tried the following:
for a_column, b_element in np.nditer([a, b]):
print(a_column)
However, I get printed the element a[0,0]
rather than the column a[0,:]
, which I want.
How can I solve this?