Skip to content

Table of Contents

t3co/tco/ledger

Ledger Objects

Python
class Ledger()

__new__

Python
def __new__(cls, *args, **kwargs)

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

Python
def set_discounted_costs()

Sets the discounted cost components for the Ledger instance.

set_discounted_tco

Python
def set_discounted_tco()

Sets the discounted TCO for the Ledger instance.

set_cost_components

Python
def set_cost_components()

Sets the cost components for the Ledger instance.

to_dict

Python
def to_dict(include_prefix: bool = True, flatten: bool = True) -> 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

Python
def to_df() -> pd.DataFrame

Converts the Ledger instance to a DataFrame.

Returns:

  • pd.DataFrame - The Ledger instance as a DataFrame.

to_csv

Python
def to_csv(filepath: Union[str, Path]) -> None

Saves the Ledger instance to a CSV file.

Arguments:

  • filepath Union[str, Path] - The file path where the CSV will be saved.

__str__

Python
def __str__() -> str

Returns a string representation of the Ledger instance.

Returns:

  • str - String representation of the Ledger instance.