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)Fillna
Fillna(
*args ,
value: Any ,
include_inf: bool = True,
)-> None
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
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata |
Return the result’s metadata and the arguments kernel needs.
|
| kernel | Return the data with the nullish values filled; the data if none. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| numpy_kernel | Return a copy with the nullish values filled; the data if none. |
| fillna | Return a patch with nullish values replaced by a value. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |