다음을 통해 공유


create_metric_definition

Important

Some or all of this functionality is available as part of a preview release. The content and the functionality are subject to change.

create_metric_definition(metric_properties: dict, skip_save_to_lakehouse: bool = False, skip_duplicate_check: bool = False)  

Parameters:

  • metric_properties (dict): Properties of the metric to be created. Note, ensure that you provide the properties in the same manner as specified in the metrics_definitions_config.json file in the ESGMetrics/Config folder in ConfigAndDemoData Lakehouse. For more information, go to Prebuilt ESG metrics library.
  • skip_save_to_lakehouse (bool, optional): Updates the DataFrame but doesn't save to the Lakehouse.
  • skip_duplicate_check (bool, optional): Skip checking for duplicate metric names.

Description:
Adds a new metric to the metrics definitions DataFrame.

Raises:

  • ValueError: If a metric with the same name already exists.

Example usage:

metrics_manager = MetricsManager()
metric_properties = {  
    "metric_name": "Gross Scope 1 greenhouse gas emissions",  
    "measure_name": "Emissions",  
    "dimensions": ["EmissionsAggregate[UnitOfMeasureName]", "EmissionsAggregate[ReportingPeriod]"],  
    "filters": {"EmissionsAggregate[isRolledUp]": ["False"], "EmissionsAggregate[Scope]": ["Scope 1"], "EmissionsAggregate[AccountingMethod]": ["Location based", None]},  
    "sustainability_area": "Climate Change",  
    "labels": {"Reporting standard": ["CSRD"], "Disclosure datapoint": ["E1-6_07", "E1-6_01"]}  
}  
metrics_manager.create_metric_definition(metric_properties)