measures.total_measures

measures.total_measures(rows)

Add the measures of several units into one row named total.

Parameters

Name Type Description Default
rows Iterable[UnitMeasures] The measures of the units, for example from unit_measures. required

Returns

Name Type Description
UnitMeasures UnitMeasures The sums of every count under the unit name total. Its UnitMeasures.intent_coverage and UnitMeasures.ratio are the shares of the sums, not the mean of the shares.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import load_spec, make_sample_repo, total_measures, unit_measures

with TemporaryDirectory() as tmp:
    spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
    rows = [unit_measures(spec, name) for name in spec.units]
    total = total_measures(rows)
    print(total.unit, total.covered_items, total.intent_items, total.ratio)
total 1 1 4.4