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

Function mean_agg

dask/array/reductions.py:367–379  ·  view source on GitHub ↗
(pairs, dtype="f8", axis=None, computing_meta=False, **kwargs)

Source from the content-addressed store, hash-verified

365
366
367def mean_agg(pairs, dtype="f8", axis=None, computing_meta=False, **kwargs):
368 ns = deepmap(lambda pair: pair["n"], pairs) if not computing_meta else pairs
369 n = _concatenate2(ns, axes=axis)
370 n = np.sum(n, axis=axis, dtype=dtype, **kwargs)
371
372 if computing_meta:
373 return n
374
375 totals = deepmap(lambda pair: pair["total"], pairs)
376 total = _concatenate2(totals, axes=axis).sum(axis=axis, dtype=dtype, **kwargs)
377
378 with np.errstate(divide="ignore", invalid="ignore"):
379 return divide(total, n, dtype=dtype)
380
381
382@derived_from(np)

Callers

nothing calls this directly

Calls 4

deepmapFunction · 0.90
_concatenate2Function · 0.90
divideFunction · 0.70
sumMethod · 0.45

Tested by

no test coverage detected