Test each value in the array for whether it is a missing value. Returns ------- isnull : Variable Same type and shape as object, but the dtype of the data is bool. See Also -------- pandas.isnull Examples --------
(self, keep_attrs: bool | None = None)
| 2339 | return duck_array_ops.reshape(variable.data, shape), tuple(axes) |
| 2340 | |
| 2341 | def isnull(self, keep_attrs: bool | None = None): |
| 2342 | """Test each value in the array for whether it is a missing value. |
| 2343 | |
| 2344 | Returns |
| 2345 | ------- |
| 2346 | isnull : Variable |
| 2347 | Same type and shape as object, but the dtype of the data is bool. |
| 2348 | |
| 2349 | See Also |
| 2350 | -------- |
| 2351 | pandas.isnull |
| 2352 | |
| 2353 | Examples |
| 2354 | -------- |
| 2355 | >>> var = xr.Variable("x", [1, np.nan, 3]) |
| 2356 | >>> var |
| 2357 | <xarray.Variable (x: 3)> Size: 24B |
| 2358 | array([ 1., nan, 3.]) |
| 2359 | >>> var.isnull() |
| 2360 | <xarray.Variable (x: 3)> Size: 3B |
| 2361 | array([False, True, False]) |
| 2362 | """ |
| 2363 | from xarray.computation.apply_ufunc import apply_ufunc |
| 2364 | |
| 2365 | if keep_attrs is None: |
| 2366 | keep_attrs = _get_keep_attrs(default=True) |
| 2367 | |
| 2368 | return apply_ufunc( |
| 2369 | duck_array_ops.isnull, |
| 2370 | self, |
| 2371 | dask="allowed", |
| 2372 | keep_attrs=keep_attrs, |
| 2373 | ) |
| 2374 | |
| 2375 | def notnull(self, keep_attrs: bool | None = None): |
| 2376 | """Test each value in the array for whether it is not a missing value. |