mario.Database.get_aggregation_excel
Create an aggregation workbook for one or more sets.
Use region_aggregation when you want MARIO to prefill the Region sheet
for you. This is useful both for region-only aggregation and for mixed
workflows where you want to aggregate Region together with other sets such
as Sector.
db.get_aggregation_excel(
path="/path/to/exiobase_region_template.xlsx",
levels=["Sector"],
region_aggregation="continent",
overwrite=True,
)
The resulting workbook contains a prefilled Region sheet and leaves the
other requested sheets empty for manual editing.
Special case: regional classifications#
Common classifications use the label index and one Aggregation column.
For regional classifications, when
get_index(set_name) returns a regional
dictionary, its sheet instead has three columns:
Regions |
Item |
Aggregation |
|---|---|---|
IT, FR |
A |
Industry |
IT, FR |
B |
Industry |
GB |
A |
Services |
GB |
C |
Services |
Regions share rows only when their complete sets of labels are identical; label order does not matter. A label appearing in two different classifications has separate rows for those groups. Regions with unique classifications are included as groups of one, so their activities and commodities can still be aggregated. Empty regional classifications have no item rows. The grouping is computed independently for each set, including regional consumption categories.
For a nonuniform database, the Region sheet has Regions, Region and
Aggregation columns. It includes only groups of at least two regions whose
classifications match across every regional set. The first column displays
each compatibility group. Regions omitted from this sheet remain in the
database unchanged. The sheet can be empty when no regions are compatible.
Regions cells contain comma-separated region labels. Labels containing a
comma or double quote are CSV-quoted automatically. These are literal string
comparisons, with no inferred semantic harmonization.
- Database.get_aggregation_excel(
- path=None,
- levels='all',
- overwrite=False,
- region_aggregation=None,
Write an aggregation template workbook for the selected levels.
- Parameters:
path – Output path for the workbook. When omitted, MARIO writes to the default Excel output directory.
levels – One classification level, an iterable of levels, or
"all"to include every aggregable level for the current table type.overwrite – When
True, replace an existing workbook atpath.region_aggregation – Optional Region prefill used to aggregate regions without manually editing the
Regionsheet. Accepted values are preset strings such as"continent","UNregion","EU","OECD","G7"and"G20", or an explicit mapping/Series/DataFrame.
- Returns:
The workbook is written to disk.
- Return type:
None
Notes
Common classifications use a label index and an Aggregation column. In the special case of nonuniform regional sets, the item sheets use Regions/Item/Aggregation columns. Regions with identical complete label sets share rows, including single-region groups. The Region sheet lists only groups compatible across all regional sets.