MCPcopy
hub / github.com/dask/dask / mean_agg

Function mean_agg

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

Source from the content-addressed store, hash-verified

368
369
370def mean_agg(pairs, dtype="f8", axis=None, computing_meta=False, **kwargs):
371 ns = deepmap(lambda pair: pair["n"], pairs) if not computing_meta else pairs
372 n = _concatenate2(ns, axes=axis)
373 n = np.sum(n, axis=axis, dtype=dtype, **kwargs)
374
375 if computing_meta:
376 return n
377
378 totals = deepmap(lambda pair: pair["total"], pairs)
379 total = _concatenate2(totals, axes=axis).sum(axis=axis, dtype=dtype, **kwargs)
380
381 with np.errstate(divide="ignore", invalid="ignore"):
382 return divide(total, n, dtype=dtype)
383
384
385@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

Used in the wild real call sites across dependent graphs

searching dependent graphs…