Return the complex conjugate, element-wise.
The complex conjugate of a complex number is obtained by changing the sign of its imaginary part.
Input value.
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.
For other keyword-only arguments, see the ufunc docs.
The complex conjugate of x, with same dtype as y. This is a scalar if x is a scalar.
conj is an alias for conjugate:


Return a copy of the array.
Controls the memory layout of the copy. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible. (Note that this function and numpy.copy are very similar but have different default values for their order= arguments, and this function always passes sub-classes through.)
See also
Similar function with different default behavior numpy.copyto
This function is the preferred method for creating an array copy. The function numpy.copy is similar, but it defaults to using order ‘K’, and will not pass sub-classes through by default.


Return Pearson product-moment correlation coefficients.
Except for the handling of missing data this function does the same as numpy.corrcoef. For more details and examples, see numpy.corrcoef.
A 1-D or 2-D array containing multiple variables and observations. Each row of x represents a variable, and each column a single observation of all those variables. Also see rowvar below.
An additional set of variables and observations. y has the same shape as x.
If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.
Has no effect, do not use.
Deprecated since version 1.10.0.
If True, masked values are propagated pair-wise: if a value is masked in x, the corresponding value is masked in y. If False, raises an exception. Because bias is deprecated, this argument needs to be treated as keyword only to avoid a warning.
Has no effect, do not use.
Deprecated since version 1.10.0.
See also
Equivalent function in top-level NumPy module.
Estimate the covariance matrix.
This function accepts but discards arguments bias and ddof. This is for backwards compatibility with previous versions of this function. These arguments had no effect on the return values of the function and can be safely ignored in this and previous versions of numpy.


Count the non-masked elements of the array along the given axis.
Axis or axes along which the count is performed. The default, None, performs the count over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.
New in version 1.10.0.
If this is a tuple of ints, the count is performed on multiple axes, instead of a single axis or all the axes as before.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
An array with the same shape as the input array, with the specified axis removed. If the array is a 0-d array, or if axis is None, a scalar is returned.
See also
Count masked elements in array or along a given axis.
When the axis keyword is specified an array of appropriate size is returned.


Count the number of masked elements along the given axis.
An array with (possibly) masked elements.
Axis along which to count. If None (default), a flattened version of the array is used.
The total number of masked elements (axis=None) or the number of masked elements along each slice of the given axis.
See also
Count non-masked elements.
When the axis keyword is used an array is returned.


Estimate the covariance matrix.
Except for the handling of missing data this function does the same as numpy.cov. For more details and examples, see numpy.cov.
By default, masked values are recognized as such. If x and y have the same shape, a common mask is allocated: if x[i,j] is masked, then y[i,j] will also be masked. Setting allow_masked to False will raise an exception if values are missing in either of the input arrays.
A 1-D or 2-D array containing multiple variables and observations. Each row of x represents a variable, and each column a single observation of all those variables. Also see rowvar below.
An additional set of variables and observations. y has the same shape as x.
If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.
Default normalization (False) is by (N-1), where N is the number of observations given (unbiased estimate). If bias is True, then normalization is by N. This keyword can be overridden by the keyword ddof in numpy versions >= 1.5.
If True, masked values are propagated pair-wise: if a value is masked in x, the corresponding value is masked in y. If False, raises a ValueError exception when some values are missing.
If not None normalization is by (N - ddof), where N is the number of observations; this overrides the value implied by bias. The default value is None.
New in version 1.5.
Raised if some values are missing and allow_masked is False.
See also


Return the cumulative product of the array elements over the given axis.
Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations.
Refer to numpy.cumprod for full documentation.
See also
corresponding function for ndarrays
equivalent function
The mask is lost if out is not a valid MaskedArray !
Arithmetic is modular when using integer types, and no error is raised on overflow.


Return the cumulative sum of the array elements over the given axis.
Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations.
Refer to numpy.cumsum for full documentation.
See also
corresponding function for ndarrays
equivalent function
The mask is lost if out is not a valid ma.MaskedArray !
Arithmetic is modular when using integer types, and no error is raised on overflow.


Return the default fill value for the argument object.
The default filling value depends on the datatype of the input array or the type of the input scalar:
datatype
default
bool
True
int
999999
float
1.e20
complex
1.e20+0j
object
‘?’
string
‘N/A’
For structured types, a structured scalar is returned, with each field the default fill value for its type.
For subarray types, the fill value is an array of the same size containing the default scalar fill value.
The array data-type or scalar for which the default fill value is returned.
The default fill value.


Extract a diagonal or construct a diagonal array.
This function is the equivalent of numpy.diag that takes masked values into account, see numpy.diag for details.
See also
Equivalent function for ndarrays.


Calculate the n-th discrete difference along the given axis.
The first difference is given by out[i] = a[i+1] - a[i] along the given axis, higher differences are calculated by using diff recursively.
Input array
The number of times values are differenced. If zero, the input is returned as-is.
The axis along which the difference is taken, default is the last axis.
Values to prepend or append to a along axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match a except along axis.
New in version 1.16.0.
The n-th differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. The type of the output is the same as the type of the difference between any two elements of a. This is the same as the type of a in most cases. A notable exception is datetime64, which results in a timedelta64 output array.
See also
Type is preserved for boolean arrays, so the result will contain False when consecutive elements are the same and True when they differ.
For unsigned integer arrays, the results will also be unsigned. This should not be surprising, as the result is consistent with calculating the difference directly:
If this is not desirable, then the array should be cast to a larger integer type first:


Return the dot product of two arrays.
This function is the equivalent of numpy.dot that takes masked values into account. Note that strict and out are in different position than in the method version. In order to maintain compatibility with the corresponding method, it is recommended that the optional arguments be treated as keyword only. At some point that may be mandatory.
Note
Works only with 2-D arrays at the moment.
Inputs arrays.
Whether masked data are propagated (True) or set to 0 (False) for the computation. Default is False. Propagating the mask means that if a masked value appears in a row or column, the whole row or column is considered masked.
Output argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and its dtype must be the dtype that would be returned for dot(a,b). This is a performance feature. Therefore, if these conditions are not met, an exception is raised, instead of attempting to be flexible.
New in version 1.10.2.
See also
Equivalent function for ndarrays.


Stack arrays in sequence depth wise (along third axis).
This is equivalent to concatenation along the third axis after 2-D arrays of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by dsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.
The array formed by stacking the given arrays, will be at least 3-D.
See also
Join a sequence of arrays along an existing axis.
Join a sequence of arrays along a new axis.
Assemble an nd-array from nested lists of blocks.
Stack arrays in sequence vertically (row wise).
Stack arrays in sequence horizontally (column wise).
Stack 1-D arrays as columns into a 2-D array.
Split array along third axis.
The function is applied to both the _data and the _mask, if any.


Compute the differences between consecutive elements of an array.
This function is the equivalent of numpy.ediff1d that takes masked values into account, see numpy.ediff1d for details.
See also
Equivalent function for ndarrays.


Return a new array of given shape and type, without initializing entries.
Shape of the empty array, e.g., (2, 3) or 2.
Desired output data-type for the array, e.g, numpy.int8. Default is numpy.float64.
Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
See also
Return an empty array with shape and type of input.
Return a new array setting values to one.
Return a new array setting values to zero.
Return a new array of given shape filled with value.
empty, unlike zeros, does not set the array values to zero, and may therefore be marginally faster. On the other hand, it requires the user to manually set all the values in the array, and should be used with caution.


Return a new array with the same shape and type as a given array.
The shape and data-type of prototype define these same attributes of the returned array.
Overrides the data type of the result.
New in version 1.6.0.
Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype as closely as possible.
New in version 1.6.0.
If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to True.
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
Array of uninitialized (arbitrary) data with the same shape and type as prototype.
See also
Return an array of ones with shape and type of input.
Return an array of zeros with shape and type of input.
Return a new array with shape of input filled with value.
Return a new uninitialized array.
This function does not initialize the returned array; to do that use zeros_like or ones_like instead. It may be marginally faster than the functions that do set the array values.


Expand the shape of an array.
Insert a new axis that will appear at the axis position in the expanded array shape.
Input array.
Position in the expanded axes where the new axis (or axes) is placed.
Deprecated since version 1.13.0: Passing an axis where axis > a.ndim will be treated as axis == a.ndim, and passing axis < -a.ndim - 1 will be treated as axis == 0. This behavior is deprecated.
Changed in version 1.18.0: A tuple of axes is now supported. Out of range axes as described above are now forbidden and raise an AxisError.
View of a with the number of dimensions increased.
See also
The inverse operation, removing singleton dimensions
Insert, remove, and combine dimensions, and resize existing ones
The following is equivalent to x[np.newaxis, :] or x[np.newaxis]:
The following is equivalent to x[:, np.newaxis]:
axis may also be a tuple:
Note that some examples may use None instead of np.newaxis. These are the same objects:


Return input as an array with masked data replaced by a fill value.
If a is not a MaskedArray, a itself is returned. If a is a MaskedArray and fill_value is None, fill_value is set to a.fill_value.
An input object.
Can be scalar or non-scalar. If non-scalar, the resulting filled array should be broadcastable over input array. Default is None.
The filled array.
See also


Return input with invalid data masked and replaced by a fill value.
Invalid data means values of nan, inf, etc.
Input array, a (subclass of) ndarray.
Mask. Must be convertible to an array of booleans with the same shape as data. True indicates a masked (i.e. invalid) data.
Whether to use a copy of a (True) or to fix a in place (False). Default is True.
Value used for fixing invalid data. Default is None, in which case the a.fill_value is used.
The input array with invalid entries fixed.
A copy is performed by default.


Find contiguous unmasked data in a masked array along the given axis.
The input array.
A sorted sequence of slice objects (start index, end index).
Changed in version 1.15.0: Now returns an empty list instead of None for a fully masked array
See also
Only accepts 2-D arrays at most.


Find the indices of the first and last unmasked values.
Expects a 1-D MaskedArray, returns None if all values are masked.
Input 1-D MaskedArray
The indices of first and last non-masked value in the array. Returns None if all values are masked.
See also
Only accepts 1-D arrays.


Interpret a buffer as a 1-dimensional array.
An object that exposes the buffer interface.
Data-type of the returned array; default: float.
Number of items to read. -1 means all data in the buffer.
Start reading the buffer from this offset (in bytes); default: 0.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
If the buffer has data that is not in machine byte-order, this should be specified as part of the data-type, e.g.:
The data of the resulting array will not be byteswapped, but will be interpreted correctly.


Construct an array by executing a function over each coordinate.
The resulting array therefore has a value fn(x, y, z) at coordinate (x, y, z).
The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape were (2, 2), then the parameters would be array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]])
Shape of the output array, which also determines the shape of the coordinate arrays passed to function.
Data-type of the coordinate arrays passed to function. By default, dtype is float.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
The result of the call to function is passed back directly. Therefore the shape of fromfunction is completely determined by function. If function returns a scalar value, the shape of fromfunction would not match the shape parameter.
See also
Keywords other than dtype are passed to function.


Return the data of a masked array as an ndarray.
Return the data of a (if any) as an ndarray if a is a MaskedArray, else return a as a ndarray or subclass (depending on subok) if not.
Input MaskedArray, alternatively a ndarray or a subclass thereof.
Whether to force the output to be a pure ndarray (False) or to return a subclass of ndarray if appropriate (True, default).
See also
Return the mask of a masked array, or nomask.
Return the mask of a masked array, or full array of False.
Equivalently use the MaskedArray data attribute.


Return the mask of a masked array, or nomask.
Return the mask of a as an ndarray if a is a MaskedArray and the mask is not nomask, else return nomask. To guarantee a full array of booleans of the same shape as a, use getmaskarray.
Input MaskedArray for which the mask is required.
See also
Return the data of a masked array as an ndarray.
Return the mask of a masked array, or full array of False.
Equivalently use the MaskedArray mask attribute.
Result when mask == nomask


Return the mask of a masked array, or full boolean array of False.
Return the mask of arr as an ndarray if arr is a MaskedArray and the mask is not nomask, else return a full boolean array of False of the same shape as arr.
Input MaskedArray for which the mask is required.
See also
Return the mask of a masked array, or nomask.
Return the data of a masked array as an ndarray.
Result when mask == nomask


Force the mask to hard.
Whether the mask of a masked array is hard or soft is determined by its hardmask property. harden_mask sets hardmask to True.
See also


Split an array into multiple sub-arrays horizontally (column-wise).
Please refer to the split documentation. hsplit is equivalent to split with axis=1, the array is always split along the second axis regardless of the array dimension.
See also
Split an array into multiple sub-arrays of equal size.
The function is applied to both the _data and the _mask, if any.
With a higher dimensional array the split is still along the second axis.


Stack arrays in sequence horizontally (column wise).
This is equivalent to concatenation along the second axis, except for 1-D arrays where it concatenates along the first axis. Rebuilds arrays divided by hsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.
The array formed by stacking the given arrays.
See also
Join a sequence of arrays along an existing axis.
Join a sequence of arrays along a new axis.
Assemble an nd-array from nested lists of blocks.
Stack arrays in sequence vertically (row wise).
Stack arrays in sequence depth wise (along third axis).
Stack 1-D arrays as columns into a 2-D array.
Split an array into multiple sub-arrays horizontally (column-wise).
The function is applied to both the _data and the _mask, if any.


Return the identity array.
The identity array is a square array with ones on the main diagonal.
Number of rows (and columns) in n x n output.
Data-type of the output. Defaults to float.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
n x n array with its main diagonal set to one, and all other elements 0.


Return an array representing the indices of a grid.
Compute an array where the subarrays contain index values 0, 1, … varying only along the corresponding axis.
The shape of the grid.
Data type of the result.
Return a sparse representation of the grid instead of a dense representation. Default is False.
New in version 1.17.
Returns one array of grid indices, grid.shape = (len(dimensions),) + tuple(dimensions).
Returns a tuple of arrays, with grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1) with dimensions[i] in the ith place
See also
The output shape in the dense case is obtained by prepending the number of dimensions in front of the tuple of dimensions, i.e. if dimensions is a tuple (r0, ..., rN-1) of length N, the output shape is (N, r0, ..., rN-1).
The subarrays grid[k] contains the N-D array of indices along the k-th axis. Explicitly:
The indices can be used as an index into an array.
Note that it would be more straightforward in the above example to extract the required elements directly with x[:2, :3].
If sparse is set to true, the grid will be returned in a sparse representation.


Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex conjugation), in higher dimensions a sum product over the last axes.
If a and b are nonscalar, their last dimensions must match.
If a and b are both scalars or both 1-D arrays then a scalar is returned; otherwise an array is returned. out.shape = (*a.shape[:-1], *b.shape[:-1])
If both a and b are nonscalar and their last dimensions have different sizes.
See also
Sum products over arbitrary axes.
Generalised matrix product, using second last dimension of b.
Einstein summation convention.
Masked values are replaced by 0.
For vectors (1-D arrays) it computes the ordinary inner-product:
More generally, if ndim(a) = r > 0 and ndim(b) = s > 0:
or explicitly:
In addition a or b may be scalars, in which case:
Ordinary inner product for vectors:
Some multidimensional examples:
An example where b is a scalar:


Return True if m is a valid, standard mask.
This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype.
Array to test.
True if m.dtype.type is MaskType, False otherwise.
See also
Test whether input is an instance of MaskedArray.
Input must be an ndarray (or have similar attributes) for it to be considered a valid mask.
Arrays with complex dtypes don’t return True.


Determine whether input has masked values.
Accepts any object as input, but always returns False unless the input is a MaskedArray containing masked values.
Array to check for masked values.
True if x is a MaskedArray with masked values, False otherwise.
Always returns False if x isn’t a MaskedArray.


Test whether input is an instance of MaskedArray.
This function returns True if x is an instance of MaskedArray and returns False otherwise. Any object is accepted as input.
Object to test.
True if x is a MaskedArray.
See also
Alias to isMaskedArray.
Alias to isMaskedArray.


Create a boolean mask from an array.
Return m as a boolean mask, creating a copy if necessary or requested. The function can accept any sequence that is convertible to integers, or nomask. Does not require that contents must be 0s and 1s, values of 0 are interpreted as False, everything else as True.
Potential mask.
Whether to return a copy of m (True) or m itself (False).
Whether to shrink m to nomask if all its values are False.
Data-type of the output mask. By default, the output mask has a dtype of MaskType (bool). If the dtype is flexible, each field has a boolean dtype. This is ignored when m is nomask, in which case nomask is always returned.
A boolean mask derived from m.
Effect of the shrink parameter.
Using a flexible dtype.


Construct a dtype description list from a given dtype.
Returns a new dtype object, with the type of all fields in ndtype to a boolean type. Field names are not altered.
The dtype to convert.
A dtype that looks like ndtype, the type of all fields is boolean.


Return a boolean mask of the given shape, filled with False.
This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type.
A tuple indicating the shape of the mask.
If None, use a MaskType instance. Otherwise, use a new datatype with the same fields as dtype, converted to boolean types.
An ndarray of appropriate shape and dtype, filled with False.
See also
Create a boolean mask from an array.
Construct a dtype description list from a given dtype.
Defining a more complex dtype.


Mask columns of a 2D array that contain masked values.
This function is a shortcut to mask_rowcols with axis equal to 1.
See also
Mask rows and/or columns of a 2D array.
Mask where a condition is met.


Combine two masks with the logical_or operator.
The result may be a view on m1 or m2 if the other is nomask (i.e. False).
Input masks.
If copy is False and one of the inputs is nomask, return a view of the other input mask. Defaults to False.
Whether to shrink the output to nomask if all its values are False. Defaults to True.
The result masks values that are masked in either m1 or m2.
If m1 and m2 have different flexible dtypes.


Mask rows and/or columns of a 2D array that contain masked values.
Mask whole rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter.
The array to mask. If not a MaskedArray instance (or if no array elements are masked). The result is a MaskedArray with mask set to nomask (False). Must be a 2D array.
Axis along which to perform the operation. If None, applies to a flattened version of the array.
A modified version of the input array, masked depending on the value of the axis parameter.
If input array a is not 2D.
See also
Mask rows of a 2D array that contain masked values.
Mask cols of a 2D array that contain masked values.
Mask where a condition is met.
The input array’s mask is modified by this function.


Mask rows of a 2D array that contain masked values.
This function is a shortcut to mask_rowcols with axis equal to 0.
See also
Mask rows and/or columns of a 2D array.
Mask where a condition is met.


Empty masked array with all elements masked.
Return an empty masked array of the given shape and dtype, where all the data are masked.
Shape of the required MaskedArray.
Data type of the output.
A masked array with all data masked.
See also
Empty masked array modelled on an existing array.
The dtype parameter defines the underlying data type.


Empty masked array with the properties of an existing array.
Return an empty masked array of the same shape and dtype as the array arr, where all the data are masked.
An array describing the shape and dtype of the required MaskedArray.
A masked array with all data masked.
If arr doesn’t have a shape attribute (i.e. not an ndarray)
See also
Empty masked array with all elements masked.
The dtype of the masked array matches the dtype of arr.


Mask an array where equal to a given value.
This function is a shortcut to masked_where, with condition = (x == value). For floating point arrays, consider using masked_values(x, value).
See also
Mask where a condition is met.
Mask using floating point equality.


Mask an array where greater than a given value.
This function is a shortcut to masked_where, with condition = (x > value).
See also
Mask where a condition is met.


Mask an array where greater than or equal to a given value.
This function is a shortcut to masked_where, with condition = (x >= value).
See also
Mask where a condition is met.


Mask an array inside a given interval.
Shortcut to masked_where, where condition is True for x inside the interval [v1,v2] (v1 <= x <= v2). The boundaries v1 and v2 can be given in either order.
See also
Mask where a condition is met.
The array x is prefilled with its filling value.
The order of v1 and v2 doesn’t matter.


Mask an array where invalid values occur (NaNs or infs).
This function is a shortcut to masked_where, with condition = ~(np.isfinite(a)). Any pre-existing mask is conserved. Only applies to arrays with a dtype where NaNs or infs make sense (i.e. floating point types), but accepts any array_like object.
See also
Mask where a condition is met.


Mask an array where less than a given value.
This function is a shortcut to masked_where, with condition = (x < value).
See also
Mask where a condition is met.


Mask an array where less than or equal to a given value.
This function is a shortcut to masked_where, with condition = (x <= value).
See also
Mask where a condition is met.


Mask an array where not equal to a given value.
This function is a shortcut to masked_where, with condition = (x != value).
See also
Mask where a condition is met.


Mask the array x where the data are exactly equal to value.
This function is similar to masked_values, but only suitable for object arrays: for floating point, use masked_values instead.
Array to mask
Comparison value
Whether to return a copy of x.
Whether to collapse a mask full of False to nomask
The result of masking x where equal to value.
See also
Mask where a condition is met.
Mask where equal to a given value (integers).
Mask using floating point equality.
Note that mask is set to nomask if possible.


Mask an array outside a given interval.
Shortcut to masked_where, where condition is True for x outside the interval [v1,v2] (x < v1)|(x > v2). The boundaries v1 and v2 can be given in either order.
See also
Mask where a condition is met.
The array x is prefilled with its filling value.
The order of v1 and v2 doesn’t matter.


Mask using floating point equality.
Return a MaskedArray, masked where the data in array x are approximately equal to value, determined using isclose. The default tolerances for masked_values are the same as those for isclose.
For integer types, exact equality is used, in the same way as masked_equal.
The fill_value is set to value and the mask is set to nomask if possible.
Array to mask.
Masking value.
Tolerance parameters passed on to isclose
Whether to return a copy of x.
Whether to collapse a mask full of False to nomask.
The result of masking x where approximately equal to value.
See also
Mask where a condition is met.
Mask where equal to a given value (integers).
Note that mask is set to nomask if possible.
For integers, the fill value will be different in general to the result of masked_equal.


Mask an array where a condition is met.
Return a as an array masked where condition is True. Any masked values of a or condition are also masked in the output.
Masking condition. When condition tests floating point values for equality, consider using masked_values instead.
Array to mask.
If True (default) make a copy of a in the result. If False modify a in place and return a view.
The result of masking a where condition is True.
See also
Mask using floating point equality.
Mask where equal to a given value.
Mask where not equal to a given value.
Mask where less than or equal to a given value.
Mask where greater than or equal to a given value.
Mask where less than a given value.
Mask where greater than a given value.
Mask inside a given interval.
Mask outside a given interval.
Mask invalid values (NaNs or infs).
Mask array b conditional on a.
Effect of the copy argument.
When condition or a contain masked values.


method
Add self to other, and return a new masked array.


method
Returns either a new reference to self if dtype is not given or a new array of provided data type if dtype is different from the current dtype of the array.


method
Special hook for ufuncs.
Wraps the numpy array and sets the mask according to context.


method
Used if copy.copy is called on an array. Returns a copy of the array.
Equivalent to a.copy(order='K').


method
Used if copy.deepcopy is called on an array.


method
Divide other into self, and return a new masked array.


method
Check whether other equals self elementwise.
When either of the elements is masked, the result is masked as well, but the underlying boolean data are still set, with self and other considered equal if both are masked, and unequal otherwise.
For structured arrays, all fields are combined, with masked values ignored. The result is masked if all fields were masked, with self and other considered equal only if both were fully masked.


method
x.__getitem__(y) <==> x[y]
Return the item described by i, as a masked array.


method
Return the internal state of the masked array, for pickling purposes.


method
Floor divide self by other in-place.


method
Raise self to the power other, in place.


method
Subtract other from self in-place.


method
True divide self by other in-place.


method
Multiply self by other, and return a new masked array.


method
Check whether other does not equal self elementwise.
When either of the elements is masked, the result is masked as well, but the underlying boolean data are still set, with self and other considered equal if both are masked, and unequal otherwise.
For structured arrays, all fields are combined, with masked values ignored. The result is masked if all fields were masked, with self and other considered equal only if both were fully masked.


method
Raise self to the power other, masking the potential NaNs/Infs


method
Add other to self, and return a new masked array.


method
Return a 3-tuple for pickling a MaskedArray.


method
Divide self into other, and return a new masked array.


method
Multiply other by self, and return a new masked array.


method
Raise other to the power self, masking the potential NaNs/Infs


method
Subtract self from other, and return a new masked array.


method
x.__setitem__(i, y) <==> x[i]=y
Set item described by index. If value is masked, masks those locations.


method
Restore the internal state of the masked array, for pickling purposes. state is typically the output of the __getstate__ output, and is a 5-tuple:


method
Subtract other from self, and return a new masked array.


method
Divide other into self, and return a new masked array.


method
Returns True if all elements evaluate to True.
The output array is masked where all the values along the given axis are masked: if the output would have been a scalar and that all the values are masked, then the output is masked.
Refer to numpy.all for full documentation.
See also
corresponding function for ndarrays
equivalent function


method
Compute the anomalies (deviations from the arithmetic mean) along the given axis.
Returns an array of anomalies, with the same shape as the input and where the arithmetic mean is computed along the given axis.
Axis over which the anomalies are taken. The default is to use the mean of the flattened array as reference.
the default is float32; for arrays of float types it is the same as the array type.
See also
Compute the mean of the array.


method
Returns True if any of the elements of a evaluate to True.
Masked values are considered as False during computation.
Refer to numpy.any for full documentation.
See also
corresponding function for ndarrays
equivalent function


method
Returns array of indices of the maximum values along the given axis. Masked values are treated as if they had the value fill_value.
If None, the index is into the flattened array, otherwise along the specified axis
Value used to fill in the masked values. If None, the output of maximum_fill_value(self._data) is used instead.
Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output.


method
Return array of indices to the minimum values along the given axis.
If None, the index is into the flattened array, otherwise along the specified axis
Value used to fill in the masked values. If None, the output of minimum_fill_value(self._data) is used instead.
Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output.
If multi-dimension input, returns a new ndarray of indices to the minimum values along the given axis. Otherwise, returns a scalar of index to the minimum values along the given axis.


method
Return an ndarray of indices that sort the array along the specified axis. Masked values are filled beforehand to fill_value.
Axis along which to sort. If None, the default, the flattened array is used.
Changed in version 1.13.0: Previously, the default was documented to be -1, but that was in error. At some future date, the default will change to -1, as originally intended. Until then, the axis should be given explicitly when arr.ndim > 1, to avoid a FutureWarning.
The sorting algorithm used.
When a is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified.
Whether missing values (if any) should be treated as the largest values (True) or the smallest values (False) When the array contains unmasked values at the same extremes of the datatype, the ordering of these values and the masked values is undefined.
Value used internally for the masked values. If fill_value is not None, it supersedes endwith.
Array of indices that sort a along the specified axis. In other words, a[index_array] yields a sorted a.
See also
Describes sorting algorithms used.
Indirect stable sort with multiple keys.
Inplace sort.
See sort for notes on the different sorting algorithms.


method
Copy of the array, cast to a specified type.
Typecode or data-type to which the array is cast.
Controls the memory layout order of the result. ‘C’ means C order, ‘F’ means Fortran order, ‘A’ means ‘F’ order if all the arrays are Fortran contiguous, ‘C’ order otherwise, and ‘K’ means as close to the order the array elements appear in memory as possible. Default is ‘K’.
Controls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility.
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array.
By default, astype always returns a newly allocated array. If this is set to false, and the dtype, order, and subok requirements are satisfied, the input array is returned instead of a copy.
Unless copy is False and the other conditions for returning the input array are satisfied (see description for copy input parameter), arr_t is a new array of the same shape as the input array, with dtype, order given by dtype, order.
When casting from complex to float or int. To avoid this, one should use a.real.astype(t).
Changed in version 1.17.0: Casting between a simple data type and a structured one is possible only for “unsafe” casting. Casting to multiple fields is allowed, but casting from multiple fields is not.
Changed in version 1.9.0: Casting from numeric to string types in ‘safe’ casting mode requires that the string dtype length is long enough to store the max integer/float value converted.


attribute
Base object if memory is from some other object.
The base of an array that owns its memory is None:
Slicing creates a view, whose memory is shared with x:


method
Swap the bytes of the array elements
Toggle between low-endian and big-endian data representation by returning a byteswapped array, optionally swapped in-place. Arrays of byte-strings are not swapped. The real and imaginary parts of a complex number are swapped individually.
If True, swap bytes in-place, default is False.
The byteswapped array. If inplace is True, this is a view to self.
Arrays of byte-strings are not swapped
but different representation in memory


method
Use an index array to construct a new array from a set of choices.
Refer to numpy.choose for full documentation.
See also
equivalent function


method
Return an array whose values are limited to [min, max]. One of max or min must be given.
Refer to numpy.clip for full documentation.
See also
equivalent function


method
Return a where condition is True.
If condition is a MaskedArray, missing values are considered as False.
Boolean 1-d array selecting which entries to return. If len(condition) is less than the size of a along the axis, then output is truncated to length of condition array.
Axis along which the operation must be performed.
Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary.
A MaskedArray object.
Please note the difference with compressed ! The output of compress has a mask, the output of compressed does not.


method
Return all the non-masked data as a 1-D array.
A new ndarray holding the non-masked data is returned.
The result is not a MaskedArray!


method
Complex-conjugate all elements.
Refer to numpy.conjugate for full documentation.
See also
equivalent function


method
Return the complex conjugate, element-wise.
Refer to numpy.conjugate for full documentation.
See also
equivalent function


method
Return a copy of the array.
Controls the memory layout of the copy. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible. (Note that this function and numpy.copy are very similar but have different default values for their order= arguments, and this function always passes sub-classes through.)
See also
Similar function with different default behavior
This function is the preferred method for creating an array copy. The function numpy.copy is similar, but it defaults to using order ‘K’, and will not pass sub-classes through by default.


method
Count the non-masked elements of the array along the given axis.
Axis or axes along which the count is performed. The default, None, performs the count over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.
New in version 1.10.0.
If this is a tuple of ints, the count is performed on multiple axes, instead of a single axis or all the axes as before.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
An array with the same shape as the input array, with the specified axis removed. If the array is a 0-d array, or if axis is None, a scalar is returned.
See also
Count masked elements in array or along a given axis.
When the axis keyword is specified an array of appropriate size is returned.


attribute
An object to simplify the interaction of the array with the ctypes module.
This attribute creates an object that makes it easier to use arrays when calling shared libraries with the ctypes module. The returned object has, among others, data, shape, and strides attributes (see Notes below) which themselves return ctypes objects that can be used as arguments to a shared library.
Possessing attributes data, shape, strides, etc.
See also
Below are the public attributes of this object which were documented in “Guide to NumPy” (we have omitted undocumented public attributes, as well as documented private attributes):
A pointer to the memory area of the array as a Python integer. This memory area may contain data that is not aligned, or not in correct byte-order. The memory area may not even be writeable. The array flags and data-type of this array should be respected when passing this attribute to arbitrary C-code to avoid trouble that can include Python crashing. User Beware! The value of this attribute is exactly the same as self._array_interface_['data'][0].
Note that unlike data_as, a reference will not be kept to the array: code like ctypes.c_void_p((a + b).ctypes.data) will result in a pointer to a deallocated array, and should be spelt (a + b).ctypes.data_as(ctypes.c_void_p)
(c_intp*self.ndim): A ctypes array of length self.ndim where the basetype is the C-integer corresponding to dtype('p') on this platform (see c_intp). This base-type could be ctypes.c_int, ctypes.c_long, or ctypes.c_longlong depending on the platform. The ctypes array contains the shape of the underlying array.
(c_intp*self.ndim): A ctypes array of length self.ndim where the basetype is the same as for the shape attribute. This ctypes array contains the strides information from the underlying array. This strides information is important for showing how many bytes must be jumped to get to the next element in the array.
Return the data pointer cast to a particular c-types object. For example, calling self._as_parameter_ is equivalent to self.data_as(ctypes.c_void_p). Perhaps you want to use the data as a pointer to a ctypes array of floating-point data: self.data_as(ctypes.POINTER(ctypes.c_double)).
The returned pointer will keep a reference to the array.
Return the shape tuple as an array of some other c-types type. For example: self.shape_as(ctypes.c_short).
Return the strides tuple as an array of some other c-types type. For example: self.strides_as(ctypes.c_longlong).
If the ctypes module is not available, then the ctypes attribute of array objects still returns something useful, but ctypes objects are not returned and errors may be raised instead. In particular, the object will still have the as_parameter attribute which will return an integer equal to the data attribute.


method
Return the cumulative product of the array elements over the given axis.
Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations.
Refer to numpy.cumprod for full documentation.
See also
corresponding function for ndarrays
equivalent function
The mask is lost if out is not a valid MaskedArray !
Arithmetic is modular when using integer types, and no error is raised on overflow.


method
Return the cumulative sum of the array elements over the given axis.
Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations.
Refer to numpy.cumsum for full documentation.
See also
corresponding function for ndarrays
equivalent function
The mask is lost if out is not a valid ma.MaskedArray !
Arithmetic is modular when using integer types, and no error is raised on overflow.


method
Return specified diagonals. In NumPy 1.9 the returned array is a read-only view instead of a copy as in previous NumPy versions. In a future version the read-only restriction will be removed.
Refer to numpy.diagonal for full documentation.
See also
equivalent function


method
Dump a pickle of the array to the specified file. The array can be read back with pickle.load or numpy.load.
A string naming the dump file.
Changed in version 1.17.0: pathlib.Path objects are now accepted.


method
Returns the pickle of the array as a string. pickle.loads will convert the string back to an array.


method
Fill the array with a scalar value.
All elements of a will be assigned this value.


method
Return a copy of self, with masked values filled with a given value. However, if there are no masked values to fill, self will be returned instead as an ndarray.
The value to use for invalid entries. Can be scalar or non-scalar. If non-scalar, the resulting ndarray must be broadcastable over input array. Default is None, in which case, the fill_value attribute of the array is used instead.
A copy of self with invalid entries replaced by fill_value (be it the function argument or the attribute of self), or self itself as an ndarray if there are no invalid entries to be replaced.
The result is not a MaskedArray!
Subclassing is preserved. This means that if, e.g., the data part of the masked array is a recarray, filled returns a recarray:


attribute
Information about the memory layout of the array.
The flags object can be accessed dictionary-like (as in a.flags['WRITEABLE']), or by using lowercased attribute names (as in a.flags.writeable). Short flag names are only supported in dictionary access.
Only the WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED flags can be changed by the user, via direct assignment to the attribute or dictionary entry, or by calling ndarray.setflags.
The array flags cannot be set arbitrarily:
Arrays can be both C-style and Fortran-style contiguous simultaneously. This is clear for 1-dimensional arrays, but can also be true for higher dimensional arrays.
Even for contiguous arrays a stride for a given dimension arr.strides[dim] may be arbitrary if arr.shape[dim] == 1 or the array has no elements. It does not generally hold that self.strides[-1] == self.itemsize for C-style contiguous arrays or self.strides[0] == self.itemsize for Fortran-style contiguous arrays is true.
The data is in a single, C-style contiguous segment.
The data is in a single, Fortran-style contiguous segment.
The array owns the memory it uses or borrows it from another object.
The data area can be written to. Setting this to False locks the data, making it read-only. A view (slice, etc.) inherits WRITEABLE from its base array at creation time, but a view of a writeable array may be subsequently locked while the base array remains writeable. (The opposite is not true, in that a view of a locked array may not be made writeable. However, currently, locking a base object does not lock any views that already reference it, so under that circumstance it is possible to alter the contents of a locked array via a previously created writeable view onto it.) Attempting to change a non-writeable array raises a RuntimeError exception.
The data and all elements are aligned appropriately for the hardware.
This array is a copy of some other array. The C-API function PyArray_ResolveWritebackIfCopy must be called before deallocating to the base array will be updated with the contents of this array.
(Deprecated, use WRITEBACKIFCOPY) This array is a copy of some other array. When this array is deallocated, the base array will be updated with the contents of this array.
F_CONTIGUOUS and not C_CONTIGUOUS.
F_CONTIGUOUS or C_CONTIGUOUS (one-segment test).
ALIGNED and WRITEABLE.
BEHAVED and C_CONTIGUOUS.
BEHAVED and F_CONTIGUOUS and not C_CONTIGUOUS.


method
Return a copy of the array collapsed into one dimension.
‘C’ means to flatten in row-major (C-style) order. ‘F’ means to flatten in column-major (Fortran- style) order. ‘A’ means to flatten in column-major order if a is Fortran contiguous in memory, row-major order otherwise. ‘K’ means to flatten a in the order the elements occur in memory. The default is ‘C’.
A copy of the input array, flattened to one dimension.
See also
Return a flattened array.
A 1-D flat iterator over the array.


method
The filling value of the masked array is a scalar. When setting, None will set to a default based on the data type.
Reset to default:


method
Force the mask to hard.
Whether the mask of a masked array is hard or soft is determined by its hardmask property. harden_mask sets hardmask to True.
See also


method
Return the addresses of the data and mask areas.
If the array has no mask, the address of nomask is returned. This address is typically not close to the data in memory:


method
Return a boolean indicating whether the data is contiguous.
iscontiguous returns one of the flags of the masked array:


method
Copy an element of an array to a standard Python scalar and return it.
A copy of the specified element of the array as a suitable Python scalar
When the data type of a is longdouble or clongdouble, item() returns a scalar array object because there is no available Python scalar that would not lose information. Void arrays return a buffer object for item(), unless fields are defined, in which case a tuple is returned.
item is very similar to a[args], except, instead of an array scalar, a standard Python scalar is returned. This can be useful for speeding up access to elements of the array and doing arithmetic on elements of the array using Python’s optimized math.


attribute
Length of one array element in bytes.


method
Return the maximum along a given axis.
Axis along which to operate. By default, axis is None and the flattened input is used.
Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.
Value used to fill in the masked values. If None, use the output of maximum_fill_value().
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
New array holding the result. If out was specified, out is returned.
See also
Returns the maximum filling value for a given datatype.


method
Returns the average of the array elements along given axis.
Masked entries are ignored, and result elements which are not finite will be masked.
Refer to numpy.mean for full documentation.
See also
corresponding function for ndarrays
Equivalent function
Weighted average.


method
Return the minimum along a given axis.
Axis along which to operate. By default, axis is None and the flattened input is used.
Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.
Value used to fill in the masked values. If None, use the output of minimum_fill_value.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
New array holding the result. If out was specified, out is returned.
See also
Returns the minimum filling value for a given datatype.


attribute
Total bytes consumed by the elements of the array.
Does not include memory consumed by non-element attributes of the array object.


method
Return the indices of unmasked elements that are not zero.
Returns a tuple of arrays, one for each dimension, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values can be obtained with:
To group the indices by element, rather than dimension, use instead:
The result of this is always a 2d array, with a row for each non-zero element.
Indices of elements that are non-zero.
See also
Function operating on ndarrays.
Return indices that are non-zero in the flattened version of the input array.
Equivalent ndarray method.
Counts the number of non-zero elements in the input array.
Masked elements are ignored.
Indices can also be grouped by element.
A common use for nonzero is to find the indices of an array, where a condition is True. Given an array a, the condition a > 3 is a boolean array and since False is interpreted as 0, ma.nonzero(a > 3) yields the indices of the a where the condition is true.
The nonzero method of the condition array can also be called.


method
Return the product of the array elements over the given axis.
Masked elements are set to 1 internally for computation.
Refer to numpy.prod for full documentation.
See also
corresponding function for ndarrays
equivalent function
Arithmetic is modular when using integer types, and no error is raised on overflow.


method
Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value).
Warning
ptp preserves the data type of the array. This means the return value for an input of signed integers with n bits (e.g. np.int8, np.int16, etc) is also a signed integer with n bits. In that case, peak-to-peak values greater than 2**(n-1)-1 will be returned as negative values. An example with a work-around is shown below.
Axis along which to find the peaks. If None (default) the flattened array is used.
Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary.
Value used to fill in the masked values.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
A new array holding the result, unless out was specified, in which case a reference to out is returned.
This example shows that a negative value can be returned when the input is an array of signed integers.
A work-around is to use the view() method to view the result as unsigned integers with the same bit width:


method
Set storage-indexed locations to corresponding values.
Sets self._data.flat[n] = values[n] for each n in indices. If values is shorter than indices then it will repeat. If values has some masked values, the initial mask is updated in consequence, else the corresponding values are unmasked.
Target indices, interpreted as integers.
Values to place in self._data copy at target indices.
Specifies how out-of-bounds indices will behave. ‘raise’ : raise an error. ‘wrap’ : wrap around. ‘clip’ : clip to the range.
values can be a scalar or length 1 array.


method
Returns a 1D version of self, as a view.
The elements of a are read using this index order. ‘C’ means to index the elements in C-like order, with the last axis index changing fastest, back to the first axis index changing slowest. ‘F’ means to index the elements in Fortran-like index order, with the first index changing fastest, and the last index changing slowest. Note that the ‘C’ and ‘F’ options take no account of the memory layout of the underlying array, and only refer to the order of axis indexing. ‘A’ means to read the elements in Fortran-like index order if m is Fortran contiguous in memory, C-like order otherwise. ‘K’ means to read the elements in the order they occur in memory, except for reversing the data when strides are negative. By default, ‘C’ index order is used.
Output view is of shape (self.size,) (or (np.ma.product(self.shape),)).


method
Repeat elements of an array.
Refer to numpy.repeat for full documentation.
See also
equivalent function


method
Give a new shape to the array without changing its data.
Returns a masked array containing the same data, but with a new shape. The result is a view on the original array; if this is not possible, a ValueError is raised.
The new shape should be compatible with the original shape. If an integer is supplied, then the result will be a 1-D array of that length.
Determines whether the array data should be viewed as in C (row-major) or FORTRAN (column-major) order.
A new view on the array.
See also
Equivalent function in the masked array module.
Equivalent method on ndarray object.
Equivalent function in the NumPy module.
The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use a.shape = s


method
Warning
This method does nothing, except raise a ValueError exception. A masked array does not own its data and therefore cannot safely be resized in place. Use the numpy.ma.resize function instead.
This method is difficult to implement safely and may be deprecated in future releases of NumPy.


method
Return each element rounded to the given number of decimals.
Refer to numpy.around for full documentation.
See also
corresponding function for ndarrays
equivalent function


method
Find indices where elements of v should be inserted in a to maintain order.
For full documentation, see numpy.searchsorted
See also
equivalent function


method
Reduce a mask to nomask when possible.


attribute
Number of elements in the array.
Equal to np.prod(a.shape), i.e., the product of the array’s dimensions.
a.size returns a standard arbitrary precision Python integer. This may not be the case with other methods of obtaining the same value (like the suggested np.prod(a.shape), which returns an instance of np.int_), and may be relevant if the value is used further in calculations that may overflow a fixed size integer type.


method
Force the mask to soft.
Whether the mask of a masked array is hard or soft is determined by its hardmask property. soften_mask sets hardmask to False.
See also


method
Sort the array, in-place
Array to be sorted.
Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis.
The sorting algorithm used.
When a is a structured array, this argument specifies which fields to compare first, second, and so on. This list does not need to include all of the fields.
Whether missing values (if any) should be treated as the largest values (True) or the smallest values (False) When the array contains unmasked values sorting at the same extremes of the datatype, the ordering of these values and the masked values is undefined.
Value used internally for the masked values. If fill_value is not None, it supersedes endwith.
Array of the same type and shape as a.
See also
Method to sort an array in-place.
Indirect sort.
Indirect stable sort on multiple keys.
Find elements in a sorted array.
See sort for notes on the different sorting algorithms.


method
Remove axes of length one from a.
Refer to numpy.squeeze for full documentation.
See also
equivalent function


method
Returns the standard deviation of the array elements along given axis.
Masked entries are ignored.
Refer to numpy.std for full documentation.
See also
corresponding function for ndarrays
Equivalent function


attribute
Tuple of bytes to step in each dimension when traversing an array.
The byte offset of element (i[0], i[1], ..., i[n]) in an array a is:
A more detailed explanation of strides can be found in the “ndarray.rst” file in the NumPy reference guide.
See also
Imagine an array of 32-bit integers (each 4 bytes):
This array is stored in memory as 40 bytes, one after the other (known as a contiguous block of memory). The strides of an array tell us how many bytes we have to skip in memory to move to the next position along a certain axis. For example, we have to skip 4 bytes (1 value) to move to the next column, but 20 bytes (5 values) to get to the same position in the next row. As such, the strides for the array x will be (20, 4).


method
Return the sum of the array elements over the given axis.
Masked elements are set to 0 internally.
Refer to numpy.sum for full documentation.
See also
corresponding function for ndarrays
equivalent function


method
Return a view of the array with axis1 and axis2 interchanged.
Refer to numpy.swapaxes for full documentation.
See also
equivalent function


method
Return the array data as a string containing the raw bytes in the array.
The array is filled with a fill value before the string conversion.
New in version 1.9.0.
Value used to fill in the masked values. Default is None, in which case MaskedArray.fill_value is used.
Order of the data item in the copy. Default is ‘C’.
See also
As for ndarray.tobytes, information about the shape, dtype, etc., but also about fill_value, will be lost.


method
Save a masked array to a file in binary format.
Warning
This function is not implemented yet.
When tofile is called.


method
Transforms a masked array into a flexible-type array.
The flexible type array that is returned will have two fields:
A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape.
A side-effect of transforming a masked array into a flexible ndarray is that meta information (fill_value, …) will be lost.


method
Return the data portion of the masked array as a hierarchical Python list.
Data items are converted to the nearest compatible Python type. Masked values are converted to fill_value. If fill_value is None, the corresponding entries in the output list will be None.
The value to use for invalid entries. Default is None.
The Python list representation of the masked array.


method
A compatibility alias for tobytes, with exactly the same behavior.
Despite its name, it returns bytes not strs.
Deprecated since version 1.19.0.


method
Return the sum along diagonals of the array.
Refer to numpy.trace for full documentation.
See also
equivalent function


method
Returns a view of the array with axes transposed.
For a 1-D array this has no effect, as a transposed vector is simply the same vector. To convert a 1-D array into a 2D column vector, an additional dimension must be added. np.atleast2d(a).T achieves this, as does a[:, np.newaxis]. For a 2-D array, this is a standard matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted (see Examples). If axes are not provided and a.shape = (i[0], i[1], ... i[n-2], i[n-1]), then a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]).
View of a, with axes suitably permuted.
See also
Equivalent function
Array property returning the array transposed.
Give a new shape to an array without changing its data.


method
Copy the mask and set the sharedmask flag to False.
Whether the mask is shared between masked arrays can be seen from the sharedmask property. unshare_mask ensures the mask is not shared. A copy of the mask is only made if it was shared.
See also


method
Compute the variance along the specified axis.
Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
Array containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
New in version 1.7.0.
If this is a tuple of ints, a variance is performed over multiple axes, instead of a single axis or all the axes as before.
Type to use in computing the variance. For arrays of integer type the default is float64; for arrays of float types it is the same as the array type.
Alternate output array in which to place the result. It must have the same shape as the expected output, but the type is cast if necessary.
“Delta Degrees of Freedom”: the divisor used in the calculation is N - ddof, where N represents the number of elements. By default ddof is zero.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
If the default value is passed, then keepdims will not be passed through to the var method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.
Elements to include in the variance. See reduce for details.
New in version 1.20.0.
If out=None, returns a new array containing the variance; otherwise, a reference to the output array is returned.
See also
The variance is the average of the squared deviations from the mean, i.e., var = mean(x), where x = abs(a - a.mean())**2.
The mean is typically calculated as x.sum() / N, where N = len(x). If, however, ddof is specified, the divisor N - ddof is used instead. In standard statistical practice, ddof=1 provides an unbiased estimator of the variance of a hypothetical infinite population. ddof=0 provides a maximum likelihood estimate of the variance for normally distributed variables.
Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative.
For floating-point input, the variance is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-accuracy accumulator using the dtype keyword can alleviate this issue.
In single precision, var() can be inaccurate:
Computing the variance in float64 is more accurate:
Specifying a where argument:


method
Return a view of the MaskedArray data.
Data-type descriptor of the returned view, e.g., float32 or int16. The default, None, results in the view having the same data-type as a. As with ndarray.view, dtype can also be specified as an ndarray sub-class, which then specifies the type of the returned object (this is equivalent to setting the type parameter).
Type of the returned view, either ndarray or a subclass. The default None results in type preservation.
The value to use for invalid entries (None by default). If None, then this argument is inferred from the passed dtype, or in its absence the original array, as discussed in the notes below.
See also
Equivalent method on ndarray object.
a.view() is used two different ways:
a.view(some_dtype) or a.view(dtype=some_dtype) constructs a view of the array’s memory with a different data-type. This can cause a reinterpretation of the bytes of memory.
a.view(ndarray_subclass) or a.view(type=ndarray_subclass) just returns an instance of ndarray_subclass that looks at the same array (same shape, dtype, etc.) This does not cause a reinterpretation of the memory.
If fill_value is not specified, but dtype is specified (and is not an ndarray sub-class), the fill_value of the MaskedArray will be reset. If neither fill_value nor dtype are specified (or if dtype is an ndarray sub-class), then the fill value is preserved. Finally, if fill_value is specified, but dtype is not, the fill value is set to the specified value.
For a.view(some_dtype), if some_dtype has a different number of bytes per entry than the previous dtype (for example, converting a regular array to a structured array), then the behavior of the view cannot be predicted just from the superficial appearance of a (shown by print(a)). It also depends on exactly how a is stored in memory. Therefore if a is C-ordered versus fortran-ordered, versus defined as a slice or transpose, etc., the view may give different results.


Return the maximum along a given axis.
Axis along which to operate. By default, axis is None and the flattened input is used.
Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.
Value used to fill in the masked values. If None, use the output of maximum_fill_value().
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
New array holding the result. If out was specified, out is returned.
See also
Returns the maximum filling value for a given datatype.


Return the minimum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for taking the maximum of an array with a given dtype.
An object that can be queried for it’s numeric type.
The minimum representable value.
If obj isn’t a suitable numeric type.
See also
The inverse function.
Set the filling value of a masked array.
Return current fill value.
An array of numeric data can also be passed.


Returns the average of the array elements along given axis.
Masked entries are ignored, and result elements which are not finite will be masked.
Refer to numpy.mean for full documentation.
See also
corresponding function for ndarrays
Equivalent function
Weighted average.


Compute the median along the specified axis.
Returns the median of the array elements.
Input array or object that can be converted to an array.
Axis along which the medians are computed. The default (None) is to compute the median along a flattened version of the array.
Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary.
If True, then allow use of memory of input array (a) for calculations. The input array will be modified by the call to median. This will save memory when you do not need to preserve the contents of the input array. Treat the input as undefined, but it will probably be fully or partially sorted. Default is False. Note that, if overwrite_input is True, and the input is not already an ndarray, an error will be raised.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
New in version 1.10.0.
A new array holding the result is returned unless out is specified, in which case a reference to out is returned. Return data-type is float64 for integers and floats smaller than float64, or the input data-type, otherwise.
See also
Given a vector V with N non masked values, the median of V is the middle value of a sorted copy of V (Vs) - i.e. Vs[(N-1)/2], when N is odd, or {Vs[N/2 - 1] + Vs[N/2]}/2 when N is even.


Return the minimum along a given axis.
Axis along which to operate. By default, axis is None and the flattened input is used.
Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.
Value used to fill in the masked values. If None, use the output of minimum_fill_value.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
New array holding the result. If out was specified, out is returned.
See also
Returns the minimum filling value for a given datatype.


Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for taking the minimum of an array with a given dtype.
An object that can be queried for it’s numeric type.
The maximum representable value.
If obj isn’t a suitable numeric type.
See also
The inverse function.
Set the filling value of a masked array.
Return current fill value.
An array of numeric data can also be passed.


Translate slice objects to concatenation along the first axis.
This is the masked array version of lib.index_tricks.RClass.
See also


Return the indices of unmasked elements that are not zero.
Returns a tuple of arrays, one for each dimension, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values can be obtained with:
To group the indices by element, rather than dimension, use instead:
The result of this is always a 2d array, with a row for each non-zero element.
Indices of elements that are non-zero.
See also
Function operating on ndarrays.
Return indices that are non-zero in the flattened version of the input array.
Equivalent ndarray method.
Counts the number of non-zero elements in the input array.
Masked elements are ignored.
Indices can also be grouped by element.
A common use for nonzero is to find the indices of an array, where a condition is True. Given an array a, the condition a > 3 is a boolean array and since False is interpreted as 0, ma.nonzero(a > 3) yields the indices of the a where the condition is true.
The nonzero method of the condition array can also be called.


Find contiguous unmasked data in a masked array along the given axis.
The input array.
Axis along which to perform the operation. If None (default), applies to a flattened version of the array, and this is the same as flatnotmasked_contiguous.
A list of slices (start and end indexes) of unmasked indexes in the array.
If the input is 2d and axis is specified, the result is a list of lists.
See also
Only accepts 2-D arrays at most.


Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list of two tuples, corresponding to the indices of the first and last unmasked values respectively.
The input array.
Axis along which to perform the operation. If None (default), applies to a flattened version of the array.
An array of start and end indexes if there are any masked data in the array. If there are no masked data in the array, edges is a list of the first and last index.
See also


Return a new array of given shape and type, filled with ones.
Shape of the new array, e.g., (2, 3) or 2.
The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.
Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
Array of ones with the given shape, dtype, and order.
See also
Return an array of ones with shape and type of input.
Return a new uninitialized array.
Return a new array setting values to zero.
Return a new array of given shape filled with value.


Return an array of ones with the same shape and type as a given array.
The shape and data-type of a define these same attributes of the returned array.
Overrides the data type of the result.
New in version 1.6.0.
Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
New in version 1.6.0.
If True, then the newly created array will use the sub-class type of a, otherwise it will be a base-class array. Defaults to True.
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
Array of ones with the same shape and type as a.
See also
Return an empty array with shape and type of input.
Return an array of zeros with shape and type of input.
Return a new array with shape of input filled with value.
Return a new array setting values to one.


Compute the outer product of two vectors.
Given two vectors, a = [a0, a1, ..., aM] and b = [b0, b1, ..., bN], the outer product [1] is:
First input vector. Input is flattened if not already 1-dimensional.
Second input vector. Input is flattened if not already 1-dimensional.
A location where the result is stored
New in version 1.9.0.
out[i, j] = a[i] * b[j]
See also
einsum('i,j->ij', a.ravel(), b.ravel()) is the equivalent.
A generalization to dimensions other than 1D and other operations. np.multiply.outer(a.ravel(), b.ravel()) is the equivalent.
np.tensordot(a.ravel(), b.ravel(), axes=((), ())) is the equivalent.
Masked values are replaced by 0.
: G. H. Golub and C. F. Van Loan, Matrix Computations, 3rd ed., Baltimore, MD, Johns Hopkins University Press, 1996, pg. 8.
Make a (very coarse) grid for computing a Mandelbrot set:
An example using a “vector” of letters:


Least squares polynomial fit.
Note
This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in numpy.polynomial is preferred. A summary of the differences can be found in the transition guide.
Fit a polynomial p(x) = p[0] * x**deg + ... + p[deg] of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error in the order deg, deg-1, … 0.
The Polynomial.fit class method is recommended for new code as it is more stable numerically. See the documentation of the method for more information.
x-coordinates of the M sample points (x[i], y[i]).
y-coordinates of the sample points. Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column.
Degree of the fitting polynomial
Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases.
Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned.
Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None.
If given and not False, return not just the estimate but also its covariance matrix. By default, the covariance are scaled by chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed to be unreliable except in a relative sense and everything is scaled such that the reduced chi2 is unity. This scaling is omitted if cov='unscaled', as is relevant for the case that the weights are w = 1/sigma, with sigma known to be a reliable estimate of the uncertainty.
Polynomial coefficients, highest power first. If y was 2-D, the coefficients for k-th data set are in p[:,k].
These values are only returned if full == True
coefficient matrix
coefficient matrix
For more details, see numpy.linalg.lstsq.
Present only if full == False and cov == True. The covariance matrix of the polynomial coefficient estimates. The diagonal of this matrix are the variance estimates for each coefficient. If y is a 2-D array, then the covariance matrix for the k-th data set are in V[:,:,k]
The rank of the coefficient matrix in the least-squares fit is deficient. The warning is only raised if full == False.
The warnings can be turned off by
See also
Compute polynomial values.
Computes a least-squares fit.
Computes spline fits.
Any masked values in x is propagated in y, and vice-versa.
The solution minimizes the squared error
in the equations:
The coefficient matrix of the coefficients p is a Vandermonde matrix.
polyfit issues a RankWarning when the least-squares fit is badly conditioned. This implies that the best fit is not well-defined due to numerical error. The results may be improved by lowering the polynomial degree or by replacing x by x - x.mean(). The rcond parameter can also be set to a value smaller than its default, but the resulting fit may be spurious: including contributions from the small singular values can add numerical noise to the result.
Note that fitting polynomial coefficients is inherently badly conditioned when the degree of the polynomial is large or the interval of sample points is badly centered. The quality of the fit should always be checked in these cases. When polynomial fits are not satisfactory, splines may be a good alternative.
Wikipedia, “Curve fitting”, https://en.wikipedia.org/wiki/Curve_fitting
Wikipedia, “Polynomial interpolation”, https://en.wikipedia.org/wiki/Polynomial_interpolation
It is convenient to use poly1d objects for dealing with polynomials:
High-order polynomials may oscillate wildly:
Illustration:


Returns element-wise base array raised to power from second array.
This is the masked array version of numpy.power. For details see numpy.power.
See also
The out argument to numpy.power is not supported, third has to be None.


Return the product of the array elements over the given axis.
Masked elements are set to 1 internally for computation.
Refer to numpy.prod for full documentation.
See also
corresponding function for ndarrays
equivalent function
Arithmetic is modular when using integer types, and no error is raised on overflow.


Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value).
Warning
ptp preserves the data type of the array. This means the return value for an input of signed integers with n bits (e.g. np.int8, np.int16, etc) is also a signed integer with n bits. In that case, peak-to-peak values greater than 2**(n-1)-1 will be returned as negative values. An example with a work-around is shown below.
Axis along which to find the peaks. If None (default) the flattened array is used.
Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary.
Value used to fill in the masked values.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
A new array holding the result, unless out was specified, in which case a reference to out is returned.
This example shows that a negative value can be returned when the input is an array of signed integers.
A work-around is to use the view() method to view the result as unsigned integers with the same bit width:


Returns a 1D version of self, as a view.
The elements of a are read using this index order. ‘C’ means to index the elements in C-like order, with the last axis index changing fastest, back to the first axis index changing slowest. ‘F’ means to index the elements in Fortran-like index order, with the first index changing fastest, and the last index changing slowest. Note that the ‘C’ and ‘F’ options take no account of the memory layout of the underlying array, and only refer to the order of axis indexing. ‘A’ means to read the elements in Fortran-like index order if m is Fortran contiguous in memory, C-like order otherwise. ‘K’ means to read the elements in the order they occur in memory, except for reversing the data when strides are negative. By default, ‘C’ index order is used.
Output view is of shape (self.size,) (or (np.ma.product(self.shape),)).


Returns an array containing the same data with a new shape.
Refer to MaskedArray.reshape for full documentation.
See also
equivalent function


Return a new masked array with the specified size and shape.
This is the masked equivalent of the numpy.resize function. The new array is filled with repeated copies of x (in the order that the data are stored in memory). If x is masked, the new array will be masked, and the new mask will be a repetition of the old one.
See also
Equivalent function in the top level NumPy module.
A MaskedArray is always returned, regardless of the input type.


Return a copy of a, rounded to ‘decimals’ places.
When ‘decimals’ is negative, it specifies the number of positions to the left of the decimal point. The real and imaginary parts of complex numbers are rounded separately. Nothing is done if the array is not of float type and ‘decimals’ is greater than or equal to 0.
Number of decimals to round to. May be negative.
Existing array to use for output. If not given, returns a default copy of a.
If out is given and does not have a mask attribute, the mask of a is lost!


Stack arrays in sequence vertically (row wise).
This is equivalent to concatenation along the first axis after 1-D arrays of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by vsplit.
This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
The arrays must have the same shape along all but the first axis. 1-D arrays must have the same length.
The array formed by stacking the given arrays, will be at least 2-D.
See also
Join a sequence of arrays along an existing axis.
Join a sequence of arrays along a new axis.
Assemble an nd-array from nested lists of blocks.
Stack arrays in sequence horizontally (column wise).
Stack arrays in sequence depth wise (along third axis).
Stack 1-D arrays as columns into a 2-D array.
Split an array into multiple sub-arrays vertically (row-wise).
The function is applied to both the _data and the _mask, if any.


Set the filling value of a, if a is a masked array.
This function changes the fill value of the masked array a in place. If a is not a masked array, the function returns silently, without doing anything.
Input array.
Filling value. A consistency test is performed to make sure the value is compatible with the dtype of a.
Nothing returned by this function.
See also
Return the default fill value for a dtype.
Return current fill value.
Equivalent method.
Nothing happens if a is not a masked array.


Return the shape of an array.
Input array.
The elements of the shape tuple give the lengths of the corresponding array dimensions.
See also
Equivalent array method.


Return the number of elements along a given axis.
Input data.
Axis along which the elements are counted. By default, give the total number of elements.
Number of elements along the specified axis.
See also
dimensions of array
dimensions of array
number of elements in array


Force the mask to soft.
Whether the mask of a masked array is hard or soft is determined by its hardmask property. soften_mask sets hardmask to False.
See also


Return a sorted copy of the masked array.
Equivalent to creating a copy of the array and applying the MaskedArray sort() method.
Refer to MaskedArray.sort for the full documentation
See also
equivalent method


Remove axes of length one from a.
Input data.
New in version 1.7.0.
Selects a subset of the entries of length one in the shape. If an axis is selected with shape entry greater than one, an error is raised.
The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a. Note that if all axes are squeezed, the result is a 0d array and not a scalar.
If axis is not None, and an axis being squeezed is not of length 1
See also
The inverse operation, adding entries of length one
Insert, remove, and combine dimensions, and resize existing ones


Join a sequence of arrays along a new axis.
The axis parameter specifies the index of the new axis in the dimensions of the result. For example, if axis=0 it will be the first dimension and if axis=-1 it will be the last dimension.
New in version 1.10.0.
Each array must have the same shape.
The axis in the result array along which the input arrays are stacked.
If provided, the destination to place the result. The shape must be correct, matching that of what stack would have returned if no out argument were specified.
The stacked array has one more dimension than the input arrays.
See also
Join a sequence of arrays along an existing axis.
Assemble an nd-array from nested lists of blocks.
Split array into a list of multiple sub-arrays of equal size.
The function is applied to both the _data and the _mask, if any.


Returns the standard deviation of the array elements along given axis.
Masked entries are ignored.
Refer to numpy.std for full documentation.
See also
corresponding function for ndarrays
Equivalent function


Return the sum of the array elements over the given axis.
Masked elements are set to 0 internally.
Refer to numpy.sum for full documentation.
See also
corresponding function for ndarrays
equivalent function


Return a view of the array with axis1 and axis2 interchanged.
Refer to numpy.swapaxes for full documentation.
See also
equivalent function


Return the sum along diagonals of the array.
Refer to numpy.trace for full documentation.
See also
equivalent function


Permute the dimensions of an array.
This function is exactly equivalent to numpy.transpose.
See also
Equivalent function in top-level NumPy module.


Generate a Vandermonde matrix.
The columns of the output matrix are powers of the input vector. The order of the powers is determined by the increasing boolean argument. Specifically, when increasing is False, the i-th output column is the input vector raised element-wise to the power of N - i - 1. Such a matrix with a geometric progression in each row is named for Alexandre- Theophile Vandermonde.
1-D input array.
Number of columns in the output. If N is not specified, a square array is returned (N = len(x)).
Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.
New in version 1.9.0.
Vandermonde matrix. If increasing is False, the first column is x^(N-1), the second x^(N-2) and so forth. If increasing is True, the columns are x^0, x^1, ..., x^(N-1).
See also
Masked values in the input array result in rows of zeros.
The determinant of a square Vandermonde matrix is the product of the differences between the values of the input vector:


Compute the variance along the specified axis.
Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
Array containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
New in version 1.7.0.
If this is a tuple of ints, a variance is performed over multiple axes, instead of a single axis or all the axes as before.
Type to use in computing the variance. For arrays of integer type the default is float64; for arrays of float types it is the same as the array type.
Alternate output array in which to place the result. It must have the same shape as the expected output, but the type is cast if necessary.
“Delta Degrees of Freedom”: the divisor used in the calculation is N - ddof, where N represents the number of elements. By default ddof is zero.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
If the default value is passed, then keepdims will not be passed through to the var method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.
Elements to include in the variance. See reduce for details.
New in version 1.20.0.
If out=None, returns a new array containing the variance; otherwise, a reference to the output array is returned.
See also
The variance is the average of the squared deviations from the mean, i.e., var = mean(x), where x = abs(a - a.mean())**2.
The mean is typically calculated as x.sum() / N, where N = len(x). If, however, ddof is specified, the divisor N - ddof is used instead. In standard statistical practice, ddof=1 provides an unbiased estimator of the variance of a hypothetical infinite population. ddof=0 provides a maximum likelihood estimate of the variance for normally distributed variables.
Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative.
For floating-point input, the variance is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-accuracy accumulator using the dtype keyword can alleviate this issue.
In single precision, var() can be inaccurate:
Computing the variance in float64 is more accurate:
Specifying a where argument:


Return a masked array with elements from x or y, depending on condition.
Note
When only condition is provided, this function is identical to nonzero. The rest of this documentation covers only the case where all three arguments are provided.
Where True, yield x, otherwise yield y.
Values from which to choose. x, y and condition need to be broadcastable to some shape.
An masked array with masked elements where the condition is masked, elements from x where condition is True, and elements from y elsewhere.
See also
Equivalent function in the top-level NumPy module.
The function that is called when x and y are omitted


Return a new array of given shape and type, filled with zeros.
Shape of the new array, e.g., (2, 3) or 2.
The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.
Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
New in version 1.20.0.
Array of zeros with the given shape, dtype, and order.
See also
Return an array of zeros with shape and type of input.
Return a new uninitialized array.
Return a new array setting values to one.
Return a new array of given shape filled with value.


Return an array of zeros with the same shape and type as a given array.
The shape and data-type of a define these same attributes of the returned array.
Overrides the data type of the result.
New in version 1.6.0.
Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
New in version 1.6.0.
If True, then the newly created array will use the sub-class type of a, otherwise it will be a base-class array. Defaults to True.
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
Array of zeros with the same shape and type as a.
See also
Return an empty array with shape and type of input.
Return an array of ones with shape and type of input.
Return a new array with shape of input filled with value.
Return a new array setting values to zero.


Generate package __config__.py file containing system_info information used during building the package.
This file is installed to the package installation directory.


Appends a data function to the data_files list that will generate __svn_version__.py file to the current package directory.
Generate package __svn_version__.py file from SVN revision number, it will be removed after python exits but will be available when sdist, etc commands are executed.
If __svn_version__.py existed before, nothing is done.
This is intended for working with source directories that are in an SVN repository.