Choose the mapping first; apply it to a copy while checking the result.

Use a workbook#

1 · Prepare

import mario

db = mario.load_test("IOT")
db.get_aggregation_excel(path="aggregation.xlsx")

Fill the target groups for the sets you want to aggregate. See a filled example.

2 · Apply

aggregated = db.aggregate(
    "aggregation.xlsx", inplace=False, ignore_nan=True,
)

ignore_nan=True allows unfilled labels to remain unaggregated. Aggregation still checks whether the units can be combined.

3 · Inspect

aggregated.get_index("all")
aggregated.Z
Aggregate known regions without a workbook

On a recognized MRIO such as EXIOBASE:

aggregated = db.aggregate(
    io=None, levels="Region", region_aggregation="continent",
    inplace=False,
)

Other presets are UNregion, EU, OECD, G7 and G20. You may also supply a dictionary, Series or DataFrame. Presets require recognizable region identities; the artificial test-region labels do not represent real countries.

For parameters and mapping layouts see db.aggregate().