- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 1204 Articles for Numpy
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
396 Views
To mask an array where not equal to a given value, use the numpy.ma.masked_not_equal() method in Python Numpy. This function is a shortcut to masked_where, with condition = (x != value).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 array whether the value is valid or not.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with int elements using the numpy.array() ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To mask an array where invalid values occur (NaNs or infs), use the numpy.ma.masked_invalid() method in Python Numpy. 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.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 array whether the value ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
100 Views
To return the default fill value for an array with float datatype, use the ma.default_fill_value() method in Python Numpy. The default filling value depends on the datatype of the input array or the type of the input scalar −datatypedefaultboolTrueint999999float1.e20complex1.e20+0jobject'?'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.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with float elements using the numpy.array() method −arr = np.array([[72.7, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
99 Views
To return the default fill value for the argument object, use the ma.default_fill_value() method in Python Numpy. The default filling value depends on the datatype of the input array or the type of the input scalar −datatypedefaultboolTrueint999999float1.e20complex1.e20+0jobject'?'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.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([[65, 68, 81], ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
741 Views
To mask an array where greater than a given value, use the numpy.ma.masked_greater() method in Python Numpy. This function is a shortcut to masked_where, with condition = (x > value).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 array whether the value is valid or not.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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
574 Views
To mask an array where equal to a given value, use the numpy.ma.masked_equal() method in Python Numpy. This function is a shortcut to masked_where, with condition = (x == value). For floating point arrays, consider using masked_values(x, value).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 array whether the value is valid or not.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
114 Views
To return input with invalid data masked and replaced by a fill value, use the numpy.ma.fix_invalid() method in Python Numpy. 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 array whether the value is valid or not.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([[65, 68, 81], [93, 33, 39], [73, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
118 Views
To convert the input to a masked array conserving subclasses, use the numpy.ma.asanyarray() method in Python Numpy. The function returns the MaskedArray interpretation of the input.If the input is a subclass of MaskedArray, its class is conserved. No copy is performed if the input is already an ndarray. The first parameter is the input data, in any form that can be converted to an array. The order parameter suggests whether to use row-major ('C') or column-major ('FORTRAN') memory representation. Default is 'C'.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with int elements ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
703 Views
To convert the input to a masked array of the given data-type, use the numpy.ma.asarray() method in Python Numpy. No copy is performed if the input is already an ndarray. If the input data is a subclass of MaskedArray, a base class MaskedArray is returned.The first parameter is the input data, in any form that can be converted to a masked array. The functions returns the Masked array interpretation of the first parameter. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists, ndarrays and masked arrays. The order parameter suggests whether to use row-major ('C') or ... Read More