IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)
18.2 Using

18.2 Using

Use as a replacement for numarray:

from import *
>>> x = array([1, 2, 3])
To create an array with the second element invalid, we would do:
>>> y = array([1, 2, 3], mask = [0, 1, 0])
To create a masked array where all values ``near'' 1.e20 are invalid, we can do:
>>> z = masked_values([1.0, 1.e20, 3.0, 4.0], 1.e20)
For a complete discussion of creation methods for masked arrays please see section 18.3.3 ``Constructing masked arrays''.

The numarray module is an attribute in, so to execute a method foo from numarray, you can reference it as

Usually people use both and numarray this way, but of course you can always fully-qualify the names:

>>> import
>>> x =[1, 2, 3])

The principal feature of module is class MaskedArray, the class whose instances are returned by the array constructors and most functions in module We will discuss this class first, and later cover the attributes and functions in module For now suffice it to say that among the attributes of the module are the constants from module numarray including those for declaring typecodes, NewAxis, and the mathematical constants such as pi and e. An additional typecode, MaskType, is the typecode used for masks.

Send comments to the NumArray community.