colour.utilities.fill_nan¶
-
colour.utilities.
fill_nan
(a, method='Interpolation', default=0)[source]¶ Fills given array NaNs according to given method.
- Parameters
a (array_like) – Array to fill the NaNs of.
method (unicode) – {‘Interpolation’, ‘Constant’}, Interpolation method linearly interpolates through the NaNs, Constant method replaces NaNs with
default
.default (numeric) – Value to use with the Constant method.
- Returns
NaNs filled array.
- Return type
ndarray
Examples
>>> a = np.array([0.1, 0.2, np.nan, 0.4, 0.5]) >>> fill_nan(a) array([ 0.1, 0.2, 0.3, 0.4, 0.5]) >>> fill_nan(a, method='Constant') array([ 0.1, 0.2, 0. , 0.4, 0.5])