MCPcopy
hub / github.com/pydata/xarray / isnull

Method isnull

xarray/core/common.py:1275–1316  ·  view source on GitHub ↗

Test each value in the array for whether it is a missing value. Parameters ---------- keep_attrs : bool or None, optional If True, the attributes (`attrs`) will be copied from the original object to the new one. If False, the new object wi

(self, keep_attrs: bool | None = None)

Source from the content-addressed store, hash-verified

1273 self._close = None
1274
1275 def isnull(self, keep_attrs: bool | None = None) -> Self:
1276 """Test each value in the array for whether it is a missing value.
1277
1278 Parameters
1279 ----------
1280 keep_attrs : bool or None, optional
1281 If True, the attributes (`attrs`) will be copied from
1282 the original object to the new one. If False, the new
1283 object will be returned without attributes.
1284
1285 Returns
1286 -------
1287 isnull : DataArray or Dataset
1288 Same type and shape as object, but the dtype of the data is bool.
1289
1290 See Also
1291 --------
1292 pandas.isnull
1293
1294 Examples
1295 --------
1296 >>> array = xr.DataArray([1, np.nan, 3], dims="x")
1297 >>> array
1298 <xarray.DataArray (x: 3)> Size: 24B
1299 array([ 1., nan, 3.])
1300 Dimensions without coordinates: x
1301 >>> array.isnull()
1302 <xarray.DataArray (x: 3)> Size: 3B
1303 array([False, True, False])
1304 Dimensions without coordinates: x
1305 """
1306 from xarray.computation.apply_ufunc import apply_ufunc
1307
1308 if keep_attrs is None:
1309 keep_attrs = _get_keep_attrs(default=True)
1310
1311 return apply_ufunc(
1312 duck_array_ops.isnull,
1313 self,
1314 dask="allowed",
1315 keep_attrs=keep_attrs,
1316 )
1317
1318 def notnull(self, keep_attrs: bool | None = None) -> Self:
1319 """Test each value in the array for whether it is not a missing value.

Callers

nothing calls this directly

Calls 2

_get_keep_attrsFunction · 0.90
apply_ufuncFunction · 0.90

Tested by

no test coverage detected