flexops.costing.load_tariff

flexops.costing.load_tariff(source: str | Path | dict | list | DataFrame) → DataFrame

Return an EECO tariff object (a rate_data DataFrame) from source.

source is what a CostingConfig.tariff_source string resolves to: a JSON or CSV file path, an in-memory dict/records structure, or an already built rate_data DataFrame (passed through after validation). A .csv path is routed through tariff_csv_to_dict() first. EECO 0.4.2 has no tariff loader of its own — its cost functions consume a rate_data DataFrame directly — so that DataFrame is the EECO tariff object here.

Parameters:

source – Tariff source: a JSON/CSV path, a dict/records structure, or a rate_data DataFrame.

Returns:

The validated EECO rate_data DataFrame.

Raises:

FlexDataError – If the file/structure is malformed or missing required columns; the message names the file and the offending field.