flexops.costing.merge_tariffs

flexops.costing.merge_tariffs(sources: Any) → DataFrame

Load several tariff sources and merge them into one rate_data frame.

Use this when a facility’s charges live in more than one file — typically an electric sheet and a gas sheet. Both forms end at the same place: a single validated rate_data frame whose utility column is what selects rows per leg downstream, so there is no separate tariff object per utility.

  • Sequence — ["electric.json", "gas.json"] merges every source as-is.

  • Mapping — {"electric": "e.json", "gas": "g.json"} additionally assigns each source to a utility and keeps only that utility’s rows, so a sheet carrying stray rows for another utility cannot leak into the bill.

Parameters:

sources – A sequence of tariff sources, or a mapping of EECO utility name ("electric"/"gas") to tariff source. Each source is anything load_tariff() accepts.

Returns:

The merged, validated EECO rate_data DataFrame.

Raises:

FlexConfigError – If sources is empty or not a mapping/sequence, if a mapping key is not a known EECO utility, if a mapping-assigned source contributes no rows for its utility, or if two sources define the same charge.