pymrio.Extension.characterize

Extension.characterize(factors, characterized_name_column='impact', characterization_factors_column='factor', characterized_unit_column='impact_unit', name=None, return_char_matrix=False, _meta=None)

Characterize stressors

Characterizes the extension with the characterization factors given in factors. Factors can contain more characterization factors which depend on stressors not present in the Extension - these will be automatically removed.

The dataframe passed for the characterization must be in a long format. It must contain columns with the same names as in the index of the extension.

The routine can also handle region or sector specific characterization factors. In that case, the passed dataframe must also include columns for sector and/or region. The names must be the same as the column names of the extension.

Other column names can be specified in the parameters, see below for the default values.

Note

Accordance of units is not checked - you must ensure that the characterization factors correspond to the units of the extension to be characterized.

Parameters
  • factors (pd.DataFrame) – A dataframe in long format with numerical index and columns named index.names of the extension to be characterized and ‘characterized_name_column’, ‘characterization_factors_column’, ‘characterized_unit_column’

  • characterized_name_column (str (optional)) – Name of the column with the names of the characterized account (default: “impact”)

  • characterization_factors_column (str (optional)) – Name of the column with the factors for the characterization (default: “factor”)

  • characterized_unit_column (str (optional)) – Name of the column with the units of the characterized accounts characterization (default: “impact_unit”)

  • name (string (optional)) – The new name for the extension, if None (default): name of the current extension with suffix ‘_characterized’

  • return_char_matrix (boolean (optional)) – If False (default), returns just the characterized extension. If True, returns a namedtuple with extension and the actually used characterization matrix.

  • _meta (MRIOMetaData, optional) – Metadata handler for logging, optional. Internal

Returns

  • pymrio.Extensions (when return_char_matrix==False, default) – or

  • namedtuple with

    • .extension: pymrio.Extension

    • .factors: pd.DataFrame (when return_char_matrix==True)