Lost Opportunity Costs Analysis#
Utilities for loading and validating lost-opportunity-cost analysis tables.
API path: apem.unit_based_model.evaluation.lost_opp_cost_analysis
Utilities for loading and validating lost opportunity cost tables.
- load_lost_opp_cost_table(
- path,
- *,
- algorithm_column='algorithm',
- lost_opp_cost_column='lost_opp_cost',
- component_column='component',
- value_column='value',
- sheet_name='Sheet1',
Load a lost-opportunity-cost table from disk and normalize core columns.
Supported file types are
.csv,.parquet,.txt,.xlsx, and.xls.- Parameters:
path (str | Path) – file path to load
algorithm_column (str) – source column name mapped to
algorithmlost_opp_cost_column (str) – source column name mapped to
lost_opp_costcomponent_column (str) – source column name mapped to
componentvalue_column (str) – source column name mapped to
valuesheet_name (str) – Excel sheet name when loading
.xlsx/.xls
- Returns:
validated normalized table with columns
algorithm,lost_opp_cost,component,value- Raises:
ValueError – if the file type is unsupported or parsed data fails validation
- Return type:
DataFrame
- validate_lost_opp_cost_table(df)[source]#
Validate and normalize a generic lost-opportunity-cost input table.
- Parameters:
df (DataFrame) – input table expected to contain
algorithm,lost_opp_cost,component, andvalue- Returns:
normalized copy with lowercase categorical values and numeric
value- Raises:
ValueError – if required columns are missing, unsupported categories are present, labels are empty, or no numeric values are available
- Return type:
DataFrame