import dascore as dc
# load an example patch which has some NaN values.
= dc.get_example_patch("patch_with_null")
patch
# Replace all occurrences of NaN with 0
= patch.fillna(0)
out
# Replace all occurrences of NaN with 5
= patch.fillna(5) out
fillna
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