numpy.empty_like

numpy.empty_like(a)

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

Parameters:

a : ndarray

Returned array will have same shape and type as a.

Notes

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

Examples

>>> 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

numpy.empty

Next topic

numpy.eye

This Page

Quick search