Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ma.asarray

numpy.ma.asarray(a,dtype=None,order=None)[source]

Convert the input to a masked array of the given data-type.

No copy is performed if the input is already anndarray. Ifa isa subclass ofMaskedArray, a base classMaskedArray is returned.

Parameters:
a:array_like

Input data, in any form that can be converted to a masked array. Thisincludes lists, lists of tuples, tuples, tuples of tuples, tuplesof lists, ndarrays and masked arrays.

dtype:dtype, optional

By default, the data-type is inferred from the input data.

order:{‘C’, ‘F’}, optional

Whether to use row-major (‘C’) or column-major (‘FORTRAN’) memoryrepresentation. Default is ‘C’.

Returns:
out:MaskedArray

Masked array interpretation ofa.

See also

asanyarray
Similar toasarray, but conserves subclasses.

Examples

>>>x=np.arange(10.).reshape(2,5)>>>xarray([[ 0.,  1.,  2.,  3.,  4.],       [ 5.,  6.,  7.,  8.,  9.]])>>>np.ma.asarray(x)masked_array(data = [[ 0.  1.  2.  3.  4.] [ 5.  6.  7.  8.  9.]],             mask = False,       fill_value = 1e+20)>>>type(np.ma.asarray(x))<class 'numpy.ma.core.MaskedArray'>

Previous topic

numpy.ma.masked_array

Next topic

numpy.ma.asanyarray

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp