bundles / numpy latest / numpy / ma / core / asanyarray
function
numpy.ma.core:asanyarray
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :8605
Signature
def asanyarray ( a , dtype = None , order = None ) Summary
Convert the input to a masked array, conserving subclasses.
Extended Summary
If a is a subclass of MaskedArray, its class is conserved. No copy is performed if the input is already an ndarray.
Parameters
a: array_likeInput data, in any form that can be converted to an array.
dtype: dtype, optionalBy default, the data-type is inferred from the input data.
order: {'C', 'F', 'A', 'K'}, optionalMemory layout. 'A' and 'K' depend on the order of input array
a. 'C' row-major (C-style), 'F' column-major (Fortran-style) memory representation. 'A' (any) means 'F' ifais Fortran contiguous, 'C' otherwise 'K' (keep) preserve input order Defaults to 'K'.
Returns
out: MaskedArrayMaskedArray interpretation of
a.
Examples
import numpy as np x = np.arange(10.).reshape(2, 5) x np.ma.asanyarray(x) type(np.ma.asanyarray(x))
See also
- asarray
Similar to
asanyarray, but does not conserve subclass.
Aliases
-
numpy.ma.asanyarray