bundles / numpy 2.4.4 / numpy / ma / core / asarray
function
numpy.ma.core:asarray
source: /numpy/ma/core.py :8555
Signature
def asarray ( a , dtype = None , order = None ) Summary
Convert the input to a masked array of the given data-type.
Extended Summary
No copy is performed if the input is already an ndarray. If a is a subclass of MaskedArray, a base class MaskedArray is returned.
Parameters
a: array_likeInput data, in any form that can be converted to a masked array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists, ndarrays and masked arrays.
dtype: dtype, optionalBy default, the data-type is inferred from the input data.
order: {'C', 'F'}, optionalWhether to use row-major ('C') or column-major ('FORTRAN') memory representation. Default is 'C'.
Returns
out: MaskedArrayMasked array interpretation of
a.
Examples
import numpy as np x = np.arange(10.).reshape(2, 5) x np.ma.asarray(x) type(np.ma.asarray(x))
See also
- asanyarray
Similar to
asarray, but conserves subclasses.
Aliases
-
numpy.ma.asarray