Using masked arrays to represent invalid data

A common issue arising when working with data or doing computations is the presence of invalid values. Such values can arise either from data that is missing or as a result of operations that resulted in inconsistent data. We may also want to mask array elements that we know would raise errors in further computations.

Masked arrays in NumPy are supported by the masked_array class, which is defined in the numpy.ma module. To work with masked arrays, we need first to import this module, which can be done with the following code:

import numpy.ma as ma
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset