How to create NumPy XY array from X and Y array (zip equivalent)
If you have two 1D arrays x
and y
of the same length n = x.shape[0]
in Python, this is how you can create a shape (n, 2)
array using numpy similar to the way Python’s zip
does it with list
objects:
xy = np.stack((x, y), axis=1)