What is the numpy.ma.copy() method in Python?
Overview
In Python, the ma.copy() method is used to return a copy of an input array.
Syntax
ma.copy(self, *args, **params) a.copy(order='C') = <numpy.ma.core._frommethod object>
Syntax for the ma.copy() method
Parameter value
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.
Return value
This method returns a copy of the array.
Code example
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)