4.11. get_context_data module
- class get_context_data.GetFuelPrices(input_file, aeo_case, id_col, *fuels)[source]
Bases:
objectThe GetFuelPrices class grabs the appropriate fuel prices from the aeo folder, cleans up some naming and creates a fuel_prices DataFrame for use in operating costs.
- Parameters:
input_file: String; the file containing fuel price data.
aeo_case: String; from the General Inputs sheet - the AEO fuel case to use (a CSV of fuel prices must exist in the aeo directory).
id_col: String; the column name where id data can be found.
fuels: String(s); the AEO descriptor for the fuel prices needed in the project (e.g., Motor Gasoline, Diesel).
- Note:
This class assumes a file structured like those published by EIA in the Annual Energy Outlook.
- select_aeo_table_rows(df_source, row)[source]
- Parameters:
df_source: DataFrame; contains the AEO fuel prices.
row: String; the specific row to select.
- Returns:
A DataFrame of the specific fuel price row.
- row_dict(fuel)[source]
- Parameters:
fuel: String; the fuel (gasoline/diesel).
- Returns:
A dictionary of fuel prices.
- class get_context_data.GetDeflators(input_file, id_col, id_value)[source]
Bases:
objectThe GetDeflators class returns the GDP Implicit Price Deflators for use in adjusting monetized values to a consistent cost basis.
- Parameters:
input_file: String; the file containing price deflator data.
id_col: String; the column name where id data can be found.
id_value: the value within id_col to return.
- Note:
This class assumes a file structured like those published by the Bureau of Economic Analysis.
- deflator_df()[source]
- Returns:
A DataFrame consisting of only the data for the given AEO case; the name of the AEO case is also removed from the ‘full name’ column entries.