cost_eco_model_linker.handlers.spreadsheet_interface

Functions

get_industry_codes(ws)

Retrieve industry classification codes found in the given worksheet.

find_table(→ pandas.DataFrame)

Identifies and retrieves table in a given worksheet identified by its first header.

find_cost_table(→ pandas.DataFrame)

Identifies and retrieves cost table based on initial header "Amount".

create_eia_template(wb)

find_or_fill_row(eia_template, it, year, dest, port, ...)

Attempts to identify the matching row. If none found, adds a new row.

create_cost_filters(cost_type_df[, attribution])

Returns dict of common filter combinations

fill_industry_costs(eia_template, next_idx, df, ...)

Single-pass update of industry costs in EIA template

fill_opex(it, year, dest, port, eia_template, wb, expense)

attribution : One of ["COLLECT", "RETURN", None], see Attribution column in Excel worksheets.

fill_capex(it, year, dest, port, eia_template, wb, expense)

attribution : One of ["COLLECT", "RETURN"], see Attribution column in Excel worksheets.

fill_total_costs(it, year, dest, port, eia_template, ...)

Create total row by summing CAPEX and OPEX rows.

fill_EIA_info(prod_wb, deploy_wb, it, year, dest, ...)

Module Contents

cost_eco_model_linker.handlers.spreadsheet_interface.get_industry_codes(ws: win32com.client.CDispatch)

Retrieve industry classification codes found in the given worksheet.

Parameters:

ws (win32com.client.CDispatch) – Excel WorkSheet object

Return type:

List of industry classification codes

cost_eco_model_linker.handlers.spreadsheet_interface.find_table(ws: win32com.client.CDispatch, first_header: str) pandas.DataFrame

Identifies and retrieves table in a given worksheet identified by its first header. Selects contiguous data regions.

Note: Drops NA rows.

Parameters:
  • ws (w32client.CDispatch) – Excel worksheet

  • first_header (str) – Header of first column

cost_eco_model_linker.handlers.spreadsheet_interface.find_cost_table(ws: win32com.client.CDispatch) pandas.DataFrame

Identifies and retrieves cost table based on initial header “Amount”. Selects contiguous data regions.

Note: Drops NA rows.

Parameters:

ws (w32client.CDispatch) – Excel worksheet

cost_eco_model_linker.handlers.spreadsheet_interface.create_eia_template(wb)
cost_eco_model_linker.handlers.spreadsheet_interface.find_or_fill_row(eia_template, it, year, dest, port, expense)

Attempts to identify the matching row. If none found, adds a new row. Returns the row ID (of the existing row, or the new row).

cost_eco_model_linker.handlers.spreadsheet_interface.create_cost_filters(cost_type_df, attribution=None)

Returns dict of common filter combinations

cost_eco_model_linker.handlers.spreadsheet_interface.fill_industry_costs(eia_template, next_idx, df, ind_codes, unique_ind_codes, cost_filter)

Single-pass update of industry costs in EIA template

cost_eco_model_linker.handlers.spreadsheet_interface.fill_opex(it, year, dest, port, eia_template, wb, expense, attribution=None)

attribution : One of [“COLLECT”, “RETURN”, None], see Attribution column in Excel worksheets.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_capex(it, year, dest, port, eia_template, wb, expense, attribution=None)

attribution : One of [“COLLECT”, “RETURN”], see Attribution column in Excel worksheets.

cost_eco_model_linker.handlers.spreadsheet_interface.fill_total_costs(it, year, dest, port, eia_template, prefix)

Create total row by summing CAPEX and OPEX rows.

Parameters:

prefix (str) – Prefix for expense names (e.g., “3.0_Production” or “4.0_Deployment”)

cost_eco_model_linker.handlers.spreadsheet_interface.fill_EIA_info(prod_wb, deploy_wb, it: int, year: int, dest: str, port: str, eia_template: pandas.DataFrame)