fillna

function of dascore.proc.basic source

fillna(
    patch: Patch ,
    value ,
    include_inf = True,
)-> ‘PatchType’

Return a patch with nullish values replaced by a value.

Parameters

Parameter Description
patch The patch which may contain nullish values.
value The value to replace nullish values with.
include_inf If True, also fill all non-finite values.
Note

When include_inf is False, “nullish” is defined by pandas.isnull. When include_inf is True (default), “nullish” includes non-finite values (NaN, inf, -inf) as determined by numpy.isfinite

Examples

import dascore as dc
# load an example patch which has some NaN values.
patch = dc.get_example_patch("patch_with_null")

# Replace all occurrences of NaN with 0
out = patch.fillna(0)

# Replace all occurrences of NaN with 5
out = patch.fillna(5)