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. |
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 a new array of given shape and type, filled with zeros. |
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. |
|
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). |
|
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¶
Find contiguous unmasked data in a masked array along the given axis. |
|
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. |
|
Force the mask to soft. |
Force the mask to hard. |
|
Force the mask to soft. |
|
Reduce a mask to nomask when possible. |
|
Copy the mask and set the sharedmask flag to False. |
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 array with masked data replaced by a fill value. |
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 arithmetics¶
Arithmetics¶
|
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. |
|
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. |
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. |
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. |
|
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. |
|
Compute the differences between consecutive elements of an array. |
|
Return an array representing the indices of a grid. |
|
Return a masked array with elements from x or y, depending on condition. |