In Python, the ma.copy()
method is used to return a copy of an input array.
ma.copy(self, *args, **params) a.copy(order='C') = <numpy.ma.core._frommethod object>
This method takes a parameter value, order
, which represents the memory layout of the copy. It can take any of the following order values: "C"
, "F"
, "A"
, and "K"
orders.
This method returns a copy of the array.
import numpy as np# creating an input arraymyarray = np.array([[1,2,3], [4,5,6]])# copying the arraynewarray = myarray.copy(order="F")# printing the copied arrayprint(newarray)