dropna

function of dascore.proc.basic source

dropna(
    patch: Patch ,
    dim ,
    how: Literal[‘any’, ‘all’] = any,
    include_inf = True,
)-> ‘PatchType’

Return a patch with nullish values dropped along dimension.

Parameters

Parameter Description
patch The patch which may contain nullish values.
dim The dimension along which to drop nullish values.
how “any” or “all”. If “any” drop label if any null values.
If “all” drop label if all values are nullish.
include_inf If True, drop 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")
# drop all time labels that have a single null value
out = patch.dropna("time", how="any")
# drop all distance labels that have all null values
out = patch.dropna("distance", how="all")