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

Function mean_combine

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

Source from the content-addressed store, hash-verified

342
343
344def mean_combine(
345 pairs,
346 sum=chunk.sum,
347 numel=numel,
348 dtype="f8",
349 axis=None,
350 computing_meta=False,
351 **kwargs,
352):
353 if not isinstance(pairs, list):
354 pairs = [pairs]
355
356 ns = deepmap(lambda pair: pair["n"], pairs) if not computing_meta else pairs
357 n = _concatenate2(ns, axes=axis).sum(axis=axis, **kwargs)
358
359 if computing_meta:
360 return n
361
362 totals = deepmap(lambda pair: pair["total"], pairs)
363 total = _concatenate2(totals, axes=axis).sum(axis=axis, **kwargs)
364
365 return {"n": n, "total": total}
366
367
368def mean_agg(pairs, dtype="f8", axis=None, computing_meta=False, **kwargs):

Callers

nothing calls this directly

Calls 3

deepmapFunction · 0.90
_concatenate2Function · 0.90
sumMethod · 0.45

Tested by

no test coverage detected