
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

115 Views
To return the data portion of the masked array as a hierarchical Python list, use the ma.MaskedArray.tolist() method in Numpy. 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 method returns the Python list representation of the masked array.A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated ... Read More

2K+ Views
To transform a masked array into a flexible-type array, use the ma.MaskedArray.toflex() method in Numpy. The flexible type array that is returned will have two fields: the _data field stores the _data part of the array.The method returns 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 masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for ... Read More

132 Views
To return a copy of self, with masked values filled with a given value, use the ma.MaskedArray.filled() method. The "fill_value" parameter is the value to use for invalid entries. Can be scalar or non-scalar.The fill_value is 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.The method returns 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 ... Read More

488 Views
To return all the non-masked data as a 1-D array, use the ma.MaskedArray.compressed() method in Numpy. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether the value is valid or not.The numpy.ma.MaskedArray is a subclass of ndarray designed to manipulate numerical arrays with missing data. An instance of MaskedArray can be thought as the combination of several elements:StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with int elements using the numpy.array() method ... Read More

201 Views
To swap the bytes of the masked array, use the ma.MaskedArray.byteswap() method in Numpy. The parameter "inplace" is set to True i.e. swap bytes in-place.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. It returns the byteswapped array. If inplace is True, this is a view to self.The numpy.ma.MaskedArray is a subclass of ndarray designed to manipulate numerical arrays with missing data. An instance of MaskedArray can be thought as the combination of several elements −StepsAt ... Read More

257 Views
To swap the bytes of the array elements, use the ma.MaskedArray.byteswap() method in Numpy. 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. It returns the byteswapped array. If inplace is True, this is a view to self.The numpy.ma.MaskedArray is a subclass of ndarray designed to manipulate numerical arrays with missing data. An instance of MaskedArray can be thought as the combination of several elements −StepsAt first, import the required library −import numpy as np import ... Read More

134 Views
To return the copy of the array, cast to a specified type, use the ma.MaskedArray.astype() method in Numpy. The parameter is the data-type to which the array is cast. Another parameter, order 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’.Casting between a simple data type and a structured one is possible only for “unsafe” casting.Casting to multiple fields is ... Read More

187 Views
To repeat elements of a masked array, use the ma.MaskedArray.repeat() method in Numpy. The "repeats" parameter sets the number of repetitions for each element. Here, repeats is broadcasted to fit the shape of the given axis. It returns the output array which has the same shape as a, except along the given axis.The axis is the axis along which to repeat values. By default, use the flattened input array, and return a flat output array.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with int elements using the numpy.array() method −arr = np.array([[55, ... Read More

126 Views
To set storage-indexed locations to corresponding values, use the ma.MaskedArray.put() method in Numpy. The "mode" parameter specifies how out-of-bounds indices will behave. 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.The indices are the target indices, interpreted as integers. The mode specifies how out-of-bounds indices will behave. ‘raise’ : raise an error. ‘wrap’ : wrap around. ‘clip’ : clip to the range.StepsAt first, import the required library −import numpy as np ... Read More

188 Views
To copy an element of an array to a standard Python scalar and return it, use the ma.MaskedArray.item() method in Numpy.The *args parameter, ifnone − in this case, the method only works for arrays with one element (a.size == 1), which element is copied into a standard Python scalar object and returned.int_type − this argument is interpreted as a flat index into the array, specifying which element to copy and return.tuple of int_types − functions as does a single int_type argument, except that the argument is interpreted as an nd-index into the array.StepsAt first, import the required library −import numpy ... Read More