Masked array operations#
Constants#
| alias of  | 
Creation#
From existing data#
| alias of  | |
| 
 | An array class with possibly masked values. | 
| 
 | Return a copy of the array. | 
| 
 | Interpret a buffer as a 1-dimensional array. | 
| 
 | Construct an array by executing a function over each coordinate. | 
| 
 | Return a copy of the array. | 
| Create a two-dimensional array with the flattened input as a diagonal. | 
Ones and zeros#
| 
 | Return a new array of given shape and type, without initializing entries. | 
| 
 | Return a new array with the same shape and type as a given array. | 
| 
 | Empty masked array with all elements masked. | 
| 
 | Empty masked array with the properties of an existing array. | 
| 
 | Return a new array of given shape and type, filled with ones. | 
| Return an array of ones with the same shape and type as a given array. | |
| 
 | Return a new array of given shape and type, filled with zeros. | 
| Return an array of zeros with the same shape and type as a given array. | 
Inspecting the array#
| 
 | Returns True if all elements evaluate to True. | 
| 
 | Returns True if any of the elements of a evaluate to True. | 
| 
 | Count the non-masked elements of the array along the given axis. | 
| 
 | Count the number of masked elements along the given axis. | 
| 
 | Return the mask of a masked array, or nomask. | 
| 
 | Return the mask of a masked array, or full boolean array of False. | 
| 
 | Return the data of a masked array as an ndarray. | 
| 
 | Return the indices of unmasked elements that are not zero. | 
| 
 | Return the shape of an array. | 
| 
 | Return the number of elements along a given axis. | 
| 
 | Determine whether input has masked values. | 
| 
 | Return True if m is a valid, standard mask. | 
| Test whether input is an instance of MaskedArray. | |
| 
 | Test whether input is an instance of MaskedArray. | 
| 
 | Test whether input is an instance of MaskedArray. | 
| 
 | Calculates element in test_elements, broadcasting over element only. | 
| 
 | Test whether each element of an array is also present in a second array. | 
| 
 | Finds the unique elements of an array. | 
| 
 | Returns True if all elements evaluate to True. | 
| 
 | Returns True if any of the elements of a evaluate to True. | 
| 
 | Count the non-masked elements of the array along the given axis. | 
| Return the indices of unmasked elements that are not zero. | |
| 
 | Return the shape of an array. | 
| 
 | Return the number of elements along a given axis. | 
| Returns the underlying data, as a view of the masked array. | |
| Current mask. | |
| Get or set the mask of the array if it has no named fields. | 
Manipulating a MaskedArray#
Changing the shape#
| 
 | Returns a 1D version of self, as a view. | 
| 
 | Returns an array containing the same data with a new shape. | 
| 
 | Return a new masked array with the specified size and shape. | 
| 
 | Return a copy of the array collapsed into one dimension. | 
| 
 | Returns a 1D version of self, as a view. | 
| 
 | Give a new shape to the array without changing its data. | 
| 
 | 
Modifying axes#
| 
 | Return a view of the array with axis1 and axis2 interchanged. | 
| 
 | Permute the dimensions of an array. | 
| 
 | Return a view of the array with axis1 and axis2 interchanged. | 
| 
 | Returns a view of the array with axes transposed. | 
Changing the number of dimensions#
| Convert inputs to arrays with at least one dimension. | |
| View inputs as arrays with at least two dimensions. | |
| View inputs as arrays with at least three dimensions. | |
| 
 | Expand the shape of an array. | 
| Remove axes of length one from a. | |
| 
 | Remove axes of length one from a. | 
| Join a sequence of arrays along a new axis. | |
| Stack 1-D arrays as columns into a 2-D array. | |
| 
 | Concatenate a sequence of arrays along the given axis. | 
| Stack arrays in sequence depth wise (along third axis). | |
| Stack arrays in sequence horizontally (column wise). | |
| Split an array into multiple sub-arrays horizontally (column-wise). | |
| Translate slice objects to concatenation along the first axis. | |
| Stack arrays in sequence vertically (row wise). | 
Joining arrays#
| 
 | Concatenate a sequence of arrays along the given axis. | 
| Join a sequence of arrays along a new axis. | |
| Stack arrays in sequence vertically (row wise). | |
| 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. | |
| 
 | Append values to the end of an array. | 
Operations on masks#
Creating a mask#
| 
 | Create a boolean mask from an array. | 
| 
 | Return a boolean mask of the given shape, filled with False. | 
| 
 | Combine two masks with the  | 
| 
 | Construct a dtype description list from a given dtype. | 
Accessing a mask#
| 
 | Return the mask of a masked array, or nomask. | 
| 
 | Return the mask of a masked array, or full boolean array of False. | 
| Current mask. | 
Finding masked data#
| 
 | Multidimensional index iterator. | 
| Find contiguous unmasked data in a masked array. | |
| Find the indices of the first and last unmasked values. | |
| 
 | Find contiguous unmasked data in a masked array along the given axis. | 
| 
 | Find the indices of the first and last unmasked values along an axis. | 
| Returns a list of slices corresponding to the masked clumps of a 1-D array. | |
| Return list of slices corresponding to the unmasked clumps of a 1-D array. | 
Modifying a mask#
| 
 | Mask columns of a 2D array that contain masked values. | 
| 
 | Combine two masks with the  | 
| 
 | Mask rows and/or columns of a 2D array that contain masked values. | 
| 
 | Mask rows of a 2D array that contain masked values. | 
| 
 | Force the mask to hard, preventing unmasking by assignment. | 
| 
 | Force the mask to soft (default), allowing unmasking by assignment. | 
| Force the mask to hard, preventing unmasking by assignment. | |
| Force the mask to soft (default), allowing unmasking by assignment. | |
| Reduce a mask to nomask when possible. | |
| Copy the mask and set the sharedmask flag to  | 
Conversion operations#
> to a masked array#
| 
 | Convert the input to a masked array of the given data-type. | 
| 
 | Convert the input to a masked array, conserving subclasses. | 
| 
 | Return input with invalid data masked and replaced by a fill value. | 
| 
 | Mask an array where equal to a given value. | 
| 
 | Mask an array where greater than a given value. | 
| 
 | Mask an array where greater than or equal to a given value. | 
| 
 | Mask an array inside a given interval. | 
| 
 | Mask an array where invalid values occur (NaNs or infs). | 
| 
 | Mask an array where less than a given value. | 
| 
 | Mask an array where less than or equal to a given value. | 
| 
 | Mask an array where not equal to a given value. | 
| 
 | Mask the array x where the data are exactly equal to value. | 
| 
 | Mask an array outside a given interval. | 
| 
 | Mask using floating point equality. | 
| 
 | Mask an array where a condition is met. | 
> to a ndarray#
| Suppress whole columns of a 2-D array that contain masked values. | |
| 
 | Suppress the rows and/or columns of a 2-D array that contain masked values. | 
| Suppress whole rows of a 2-D array that contain masked values. | |
| Return all the non-masked data as a 1-D array. | |
| 
 | Return input as an  | 
| Return all the non-masked data as a 1-D array. | |
| 
 | Return a copy of self, with masked values filled with a given value. | 
> to another object#
| 
 | Save a masked array to a file in binary format. | 
| 
 | Return the data portion of the masked array as a hierarchical Python list. | 
| Transforms a masked array into a flexible-type array. | |
| 
 | Return the array data as a string containing the raw bytes in the array. | 
Filling a masked array#
| 
 | Return the common filling value of two masked arrays, if any. | 
| Return the default fill value for the argument object. | |
| Return the minimum value that can be represented by the dtype of an object. | |
| Return the maximum value that can be represented by the dtype of an object. | |
| 
 | Set the filling value of a, if a is a masked array. | 
| The filling value of the masked array is a scalar. | |
| 
 | 
| The filling value of the masked array is a scalar. | 
Masked arrays arithmetic#
Arithmetic#
| 
 | Compute the anomalies (deviations from the arithmetic mean) along the given axis. | 
| 
 | Compute the anomalies (deviations from the arithmetic mean) along the given axis. | 
| 
 | Return the weighted average of array over the given axis. | 
| 
 | Return the complex conjugate, element-wise. | 
| 
 | Return Pearson product-moment correlation coefficients. | 
| 
 | Estimate the covariance matrix. | 
| 
 | Return the cumulative sum of the array elements over the given axis. | 
| 
 | Return the cumulative product of the array elements over the given axis. | 
| 
 | Returns the average of the array elements along given axis. | 
| 
 | Compute the median along the specified axis. | 
| 
 | Returns element-wise base array raised to power from second array. | 
| 
 | Return the product of the array elements over the given axis. | 
| 
 | Returns the standard deviation of the array elements along given axis. | 
| 
 | Return the sum of the array elements over the given axis. | 
| 
 | Compute the variance along the specified axis. | 
| 
 | Compute the anomalies (deviations from the arithmetic mean) along the given axis. | 
| 
 | Return the cumulative product of the array elements over the given axis. | 
| 
 | Return the cumulative sum of the array elements over the given axis. | 
| 
 | Returns the average of the array elements along given axis. | 
| 
 | Return the product of the array elements over the given axis. | 
| 
 | Returns the standard deviation of the array elements along given axis. | 
| 
 | Return the sum of the array elements over the given axis. | 
| 
 | Compute the variance along the specified axis. | 
Minimum/maximum#
| 
 | Returns array of indices of the maximum values along the given axis. | 
| 
 | Return array of indices to the minimum values along the given axis. | 
| 
 | Return the maximum along a given axis. | 
| 
 | Return the minimum along a given axis. | 
| 
 | Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value). | 
| 
 | Calculate the n-th discrete difference along the given axis. | 
| 
 | Returns array of indices of the maximum values along the given axis. | 
| 
 | Return array of indices to the minimum values along the given axis. | 
| 
 | Return the maximum along a given axis. | 
| 
 | Return the minimum along a given axis. | 
| 
 | Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value). | 
Sorting#
| 
 | Return an ndarray of indices that sort the array along the specified axis. | 
| 
 | Return a sorted copy of the masked array. | 
| 
 | Return an ndarray of indices that sort the array along the specified axis. | 
| 
 | Sort the array, in-place | 
Algebra#
| 
 | Extract a diagonal or construct a diagonal array. | 
| 
 | Return the dot product of two arrays. | 
| 
 | Return the identity array. | 
| 
 | Inner product of two arrays. | 
| 
 | Inner product of two arrays. | 
| 
 | Compute the outer product of two vectors. | 
| 
 | Compute the outer product of two vectors. | 
| 
 | Return the sum along diagonals of the array. | 
| 
 | Permute the dimensions of an array. | 
| 
 | Return the sum along diagonals of the array. | 
| 
 | Returns a view of the array with axes transposed. | 
Polynomial fit#
| 
 | Generate a Vandermonde matrix. | 
| 
 | Least squares polynomial fit. | 
Clipping and rounding#
| Round an array to the given number of decimals. | |
| Clip (limit) the values in an array. | |
| 
 | Return a copy of a, rounded to 'decimals' places. | 
| 
 | Return an array whose values are limited to  | 
| 
 | Return each element rounded to the given number of decimals. | 
Set operations#
| 
 | Returns the unique elements common to both arrays. | 
| 
 | Set difference of 1D arrays with unique elements. | 
| 
 | Set exclusive-or of 1-D arrays with unique elements. | 
| 
 | Union of two arrays. | 
Miscellanea#
| 
 | Return True if all entries of a and b are equal, using fill_value as a truth value where either or both are masked. | 
| 
 | Returns True if two arrays are element-wise equal within a tolerance. | 
| 
 | Return the maximum of an array or maximum along an axis. | 
| 
 | Return the minimum of an array or minimum along an axis. | 
| 
 | Apply a function to 1-D slices along the given axis. | 
| 
 | Apply a function repeatedly over multiple axes. | 
| 
 | Return evenly spaced values within a given interval. | 
| 
 | Use an index array to construct a new array from a list of choices. | 
| 
 | Suppress slices from multiple dimensions which contain masked values. | 
| 
 | Returns the discrete, linear convolution of two one-dimensional sequences. | 
| 
 | Cross-correlation of two 1-dimensional sequences. | 
| 
 | Compute the differences between consecutive elements of an array. | 
| 
 | Returns a completely flattened version of the mask, where nested fields are collapsed. | 
| Flatten a structured array. | |
| 
 | Build a masked array from a suitable flexible-type array. | 
| 
 | Return an array representing the indices of a grid. | 
| 
 | Shift the bits of an integer to the left. | 
| 
 | Return the number of dimensions of an array. | 
| 
 | Set storage-indexed locations to corresponding values. | 
| 
 | Changes elements of an array based on conditional and input values. | 
| 
 | Shift the bits of an integer to the right. | 
| 
 | Return a copy of a, rounded to 'decimals' places. | 
| 
 | |
| 
 | Return a masked array with elements from x or y, depending on condition. |