How to create NumPy array that is exactly as long as another array

Want to have the same size as a but a different data type? See How to create NumPy array that is exactly as long as another array but has a different data type

If you have a numpy array such as

a = np.arange(50)

you can use the following code to create an array b that has the same dimensions, i.e. the same size, and the same datataype as a using

b = np.zeros_like(a)