0 votes
in Python by
explain Numpy.copy() in Python with Example

1 Answer

0 votes
by

Numpy.copy() in Python The copy() function of Python numpy class returns an array copy for the given object. Syntax

numpy.copy(a, order='K')

Parameter a: It represent the array_like input data. order :  This parameter controls the memory layout of the copy. It is an optional parameter and supports C, F, A, k style where ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if ‘a’ is Fortran contiguous, ‘C’ otherwise and ‘K’ means match the layout of ‘a’ as closely as possible. Return This function returns the array interpretation of the specified array ‘a’. Example 1

# Python Programming giving an example for 
# numpy.ndarray.copy() function
importnumpy as numpy
n = numpy.array([[10, 11, 12, 13], [14, 15,16, 17]],
order ='F')
print("n is: \n", n)
# copying n to m
m = n.copy()
print("m is :\n", m)
print("\nn is successfully copied to m")

Output

n is:
 [[10 11 12 13]
 [14 15 16 17]]
m is :
 [[10 11 12 13]
 [14 15 16 17]]
n is successfully copied to m

Related questions

0 votes
asked May 19, 2022 in Python by john ganales
0 votes
asked May 19, 2022 in Python by john ganales
...