MCPcopy Create free account
hub / github.com/dask/dask / _nannumel_sparse

Function _nannumel_sparse

dask/array/backends.py:325–336  ·  view source on GitHub ↗

A reduction to count the number of elements in a sparse array, excluding nans. This will in general result in a dense matrix with an unpredictable fill value. So make it official and convert it to dense. https://github.com/dask/dask/issues/7169

(x, **kwargs)

Source from the content-addressed store, hash-verified

323
324
325def _nannumel_sparse(x, **kwargs):
326 """
327 A reduction to count the number of elements in a sparse array, excluding nans.
328 This will in general result in a dense matrix with an unpredictable fill value.
329 So make it official and convert it to dense.
330
331 https://github.com/dask/dask/issues/7169
332 """
333 n = _nannumel(x, **kwargs)
334 # If all dimensions are contracted, this will just be a number, otherwise we
335 # want to densify it.
336 return n.todense() if hasattr(n, "todense") else n
337
338
339class ArrayBackendEntrypoint(DaskBackendEntrypoint):

Callers

nothing calls this directly

Calls 1

_nannumelFunction · 0.85

Tested by

no test coverage detected