numpy.ma.fix_invalid()

numpy.ma.fix_invalid

numpy.ma.fix_invalid(a, mask=False, copy=True, fill_value=None) [source]

Return input with invalid data masked and replaced by a fill value.

Invalid data means values of nan, inf, etc.

Parameters:

a : array_like

Input array, a (subclass of) ndarray.

mask : sequence, optional

Mask. Must be convertible to an array of booleans with the same shape as data. Tru