pymrio.IOSystem.aggregate

IOSystem.aggregate(region_agg=None, sector_agg=None, region_names=None, sector_names=None, inplace=True)

Aggregates the IO system.

Aggregation can be given as vector (use pymrio.build_agg_vec) or aggregation matrix. In the case of a vector this must be of length self.get_regions() / self.get_sectors() respectively with the new position as integer or a string of the new name. In the case of strings the final output order can be specified in region_dict and sector_dict in the format {str1 = int_pos, str2 = int_pos, …}.

If the sector / region concordance is given as matrix or numerical vector, generic names will be used for the new sectors/regions. One can define specific names by defining the aggregation as string vector

Parameters
  • region_agg (list, array or string, optional) – The aggregation vector or matrix for the regions (np.ndarray or list). If string: aggregates to one total region and names is to the given string. Pandas DataFrame with columns ‘original’ and ‘aggregated’. This is the output from the country_converter.agg_conc

  • sector_agg (list, arrays or string, optional) – The aggregation vector or matrix for the sectors (np.ndarray or list).If string: aggregates to one total region and names is to the given string.

  • region_names (list, optional) – Names for the aggregated regions. If concordance matrix - in order of rows in this matrix If concordance vector - in order or num. values in this vector If string based - same order as the passed string Not considered if passing a DataFrame - in this case give the names in the column ‘aggregated’

  • sector_names (list, optional) – Names for the aggregated sectors. Same behaviour as ‘region_names’

  • inplace (boolean, optional) – If True, aggregates the IOSystem in place (default), otherwise aggregation happens on a copy of the IOSystem. Regardless of the setting, the IOSystem is returned to allow for chained operations.

Returns

Aggregated IOSystem (if inplace is False)

Return type

IOSystem