Create a new array with the same shape and type as another.


a : ndarray

Returned array will have same shape and type as a.

See also

zeros_like, ones_like, zeros, ones, empty


This function does not initialize the returned array; to do that use zeros_like or ones_like instead.


>>> a = np.array([[1,2,3],[4,5,6]])
>>> np.empty_like(a)
>>> np.empty_like(a)
array([[-1073741821, -1067702173,       65538],    #random data
       [      25670,    23454291,       71800]])

Previous topic

Next topic

This Page

Quick search