Preview:
import xarray as xr
import numpy as np
from xarray.core.duck_array_ops import isnull


array = xr.DataArray([1, np.nan, 3], dims="x")
array

%time np.sum(isnull(array.data), axis=()).sum()
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter