Table of Contents¶
t3co/tco/ledger¶
Ledger Objects¶
__new__¶
Creates a new instance of the Ledger class.
__init__¶
Python
def __init__(vehicle: Vehicle,
scenario: Scenario,
energy: Energy = None,
config: Config = None)
Initializes the Ledger instance.
Arguments:
vehicle
Vehicle - The vehicle instance.scenario
Scenario - The scenario instance.energy
Energy, optional - The energy instance. Defaults to None.config
Config, optional - The configuration instance. Defaults to None.
set_discounted_costs¶
Sets the discounted cost components for the Ledger instance.
set_discounted_tco¶
Sets the discounted TCO for the Ledger instance.
set_cost_components¶
Sets the cost components for the Ledger instance.
to_dict¶
Exports the Ledger instance to a dictionary.
Arguments:
include_prefix
bool, optional - If True, exported column names contain the T3CO submodule names as prefix. Defaults to True.flatten
bool, optional - If True, the nested dict output flattens to a single dictionary. Defaults to True.
Returns:
dict
- The Ledger instance as a dictionary.
to_json¶
Python
def to_json(filepath: Union[str, Path],
include_prefix: bool = True,
flatten: bool = True) -> None
Saves the Ledger instance to a JSON file.
Arguments:
filepath
Union[str, Path] - The file path where the JSON will be saved.include_prefix
bool, optional - If True, exported column names contain the T3CO submodule names as prefix. Defaults to True.flatten
bool, optional - If True, the nested dict output flattens to a single dictionary. Defaults to True.
to_df¶
Converts the Ledger instance to a DataFrame.
Returns:
pd.DataFrame
- The Ledger instance as a DataFrame.
to_csv¶
Saves the Ledger instance to a CSV file.
Arguments:
filepath
Union[str, Path] - The file path where the CSV will be saved.
__str__¶
Returns a string representation of the Ledger instance.
Returns:
str
- String representation of the Ledger instance.