numpy.ndarray.copy

ndarray.copy(order='C')

Return a copy of the array.

Parameters :

order : {‘C’, ‘F’, ‘A’}, optional

By default, the result is stored in C-contiguous (row-major) order in memory. If order is F, the result has ‘Fortran’ (column-major) order. If order is ‘A’ (‘Any’), then the result has the same order as the input.

Examples

>>> x = np.array([[1,2,3],[4,5,6]], order='F')
>>> y = x.copy()
>>> x.fill(0)
>>> x
array([[0, 0, 0],
       [0, 0, 0]])
>>> y
array([[1, 2, 3],
       [4, 5, 6]])
>>> y.flags['C_CONTIGUOUS']
True

Previous topic

numpy.ndarray.byteswap

Next topic

numpy.ndarray.view

This Page